Undefined functions in C

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Googling around, you will find many people saying that C99 disallows
undefined functions (e.g [1]), often citing C99 6.5.2.2.  My reading
of this doesn't seem to suggest it disallows undefined functions; in
fact it talks about type promotion rules for undefined functions.

And indeed, even with -std=c99 gcc still only warns about undefined
functions (and assumes they return int, etc), not gives an error.
This is particularly annoying on 64 bit architectures where the top
bits of pointers get stripped when converted to int when people forget
to include the right headers.  A compiler error (yes it warns, but
people often ignore it) rather than a segfault would be more useful.

Can anyone point me to where C99 explicitly disallows a function
without a declaration, and if so why doesn't gcc in C99 mode give an
error rather than falling back to the C89 semantics?  Or are the
numerous people suggesting C99 disallows undefined functions
incorrect?

-i
ianw@xxxxxxxxxxxxxxxxxx
http://www.gelato.unsw.edu.au

[1] http://david.tribble.com/text/cdiffs.htm ("Implicit function declarations")

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux