Mail Archives: djgpp/1997/07/08/17:04:45
Nate Eldredge wrote:
>
> That bothers me slightly. It seems that certain functions such as strcpy,
> memset, etc, are magically known about by the compiler (it refers to them as
> builtin functions). This means I can't put a strcpy of my own in the program
> unless it goes in the same source file; otherwise GCC will inline its own.
>
> I realize rewriting strcpy would be very non-ANSI and otherwise bad, but it
> seems almost like the compiler is taking liberties with the code.
Here's some peace of mind :) found this in the gcc docs.
`-fno-builtin'
Don't recognize builtin functions that do not begin with two
leading underscores. Currently, the functions affected include
`abort', `abs', `alloca', `cos', `exit', `fabs', `ffs', `labs',
`memcmp', `memcpy', `sin', `sqrt', `strcmp', `strcpy', and
`strlen'.
GCC normally generates special code to handle certain builtin
functions more efficiently; for instance, calls to `alloca' may
become single instructions that adjust the stack directly, and
calls to `memcpy' may become inline copy loops. The resulting
code is often both smaller and faster, but since the function
calls no longer appear as such, you cannot set a breakpoint on
those calls, nor can you change the behavior of the functions by
linking with a different library.
The `-ansi' option prevents `alloca' and `ffs' from being builtin
functions, since these functions do not have an ANSI standard
meaning.
Bill
--
Leave others their otherness.
- Raw text -