Re: AXP compiling HOWTO

Jim Nance (
Tue, 12 Nov 1996 09:36:23 -0500 (EST)

> Compiling issues I would like to address:
> - The basic differences between Intel and AXP Linux from a compiler
> point of view.

They are pretty simular. I guess the major difference is that RISC processors
are more sensitive to instruction ordering than CISC processors typically are.
This means that it is more work to optimize the AXP code, but that does not
really affect the way you code, only how long it takes to compile.

> - Differences in size of variables like "integers" in C etc.
> (warnings about casting integers to pointers etc)

The big difference is that pointers on the alpha are 64 bits, while
integers are 32 bits. This means that you can not store a pointer in
an integer. Now most people are smart enough not to try this anyway.
The problem occurs when you omit an include file containing a function
declaration, and you do it by accident. For example if you have a
statment like

char buff[80];
strcat(strcpy(buff, str), "new_suffix");

and you forget to include string.h, you will get a SEGV because the compiler
assumes strcpy returns in int instead of a char*, so you loose the most
significant 32 bits of the pointer.

The other terriable thing I have seen people do is try to fix a prototype
problem with a cast:

char *str = (char*) strtok(NULL, " ");

If you dont include string.h, and you leave out the cast, the compiler will
complain about the assignment of strtok(), which it assumes returns an
int, to str. Many people are tempted to try to fix this by adding the
cast. The problem is that while this shuts up the compiler, it does not
fix the problem because the compiler is still going to drop the 32 most
significant bits from the return value of strtok(). This is because it
still incorrectly assumes that strtok() returns an int, while it is
really returning a pointer. You have to have proper function declarations.

> - Common compiler switches for quick fixes.


> - Common library problems (overlaping and underlaping)

Forgetting the include files in the source.

> If there is something out there that already addresses this, please
> tell me. If there isn't, then send me tons of email about these
> subjects and links were I can collect the information.

Take a look at:


To unsubscribe: send e-mail to with
'unsubscribe' as the subject.  Do not send it to

Feedback | Store | News | Support | Product Errata | About Us | Linux Info | Search | JumpWords
No Frames | Show Frames

Copyright © 1995-1997 Red Hat Software. Legal notices