1819804 Members
3142 Online
109607 Solutions
New Discussion юеВ

ANSI C and GCC

 
SOLVED
Go to solution
John McDen
Regular Advisor

ANSI C and GCC

I already have gcc installed on my server and I am planning to install ANSI C.

Do I need GCC after that? Is ANSI C and GCC same ?? (I know GCC is freeware) ;-)

New to HP
5 REPLIES 5
Craig Rants
Honored Contributor

Re: ANSI C and GCC

I have never had a problem compiling anything with the HP provided ANSI C compiler, I don't think that I can say the same thing about the gcc compiler. Just my experience.

GL,
C
"In theory, there is no difference between theory and practice. But, in practice, there is. " Jan L.A. van de Snepscheut
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: ANSI C and GCC

They are not the same but both will compile ANSI C. After you install HP's ANSI C you can remove gcc and the Gnu assembler and other development utilities. You will probably have to modify each makefile as the compiler/linker/assembler directives/flags are different.

HP's ANSI compiler will compile both ANSI C and K & R C. If you also need to do C++ you will need the aC++ compiler as well. aC++ will compile both ANSI C and C++ but will not compile K & R C. If you need to do K & C, ANSI, and C++, you will need both HP compilers.
If it ain't broke, I can fix that.
David Burgess
Esteemed Contributor

Re: ANSI C and GCC

I've had problems compiling source code from gnu.org without gcc.
As it's free I use it. Saves a lot of grief.

HTH

Dave.
Timothy Butler
Advisor

Re: ANSI C and GCC

I'd expect HP's ansic compiler to generate faster code than gcc, but you'd have to try it on code you cared about to verify if it does or not.

Running your code past another compiler is also a good debugging technique. Sometimes the warning or error messages from one aren't as helpful as the other.

(I use "gcc -Wall -pedantic" for this purpose a lot, to help maximize portability.)

H.Merijn Brand (procura
Honored Contributor

Re: ANSI C and GCC

I've got no experience with aCC, but HP C-ANSI-C is faster than gcc

Be sure to keep up to date with HP's patches for optimal performance.

HP C-ANSI-C is rather picky on ANSI features, where gcc allows a lot of deviations. gcc is great in warnings and though less picky, it prevents you from errors.

We use HPc to compile programs and applications that we ship to clients, and once in a while compile everything again with gcc to see if new warnings appear.

*IF* you choose for the free gcc, try to use the most recent stable version (3.0.4 at the moment), because GNU has moved HP-PA up in priority for primary target architectures, and specific HP-PA changes are made on a daily basis at the moment.

Do not try to use 3.1 yet.

both HPc and gcc are 32 *or* 64 bit compilers, you cannot link 32bit objects to 64bit object or visa versa

HPc and gcc will run nicely together without interference. I've even got 4 gcc versions that do not interfere (takes some wrappers and some precautions, but it works)

HTH
Enjoy, Have FUN! H.Merijn