Re: I request inclusion of reiser4 in the mainline kernel

Alexandre Oliva
2005-09-20T17:53:49Z

On Sep 20, 2005, Stephen Pollei <stephen.pollei@gmail.com> wrote:

> On 9/19/05, Horst von Brand <vonbrand@inf.utfsm.cl> wrote:
>> Nikita Danilov <nikita@clusterfs.com> wrote:
>> > It's other way around: declaration is guarded by the preprocessor
>> > conditional so that nobody accidentally use znode_is_loaded() outside of
>> > the debugging mode.
>>
>> Since when has a missing declaration prevented anyone calling a function in
>> C?!
> Never AFAIK... K&R, ANSI,ISO C89, c99, whatever version that I know of...

Actually... C99 requires a declaration (not necessarily with a
prototype) before a function can be called. A prior declaration is
required for all identifiers. I'm not sure whether this is new in C99
or carried over from ISO C90 (AKA ANSI C89). The fact that so many
compilers accept calls without prior declarations is a common
extension to the language, mainly for backward compatibility.

> It's really over silly anyway, as it will fail at link time if they
> had matching preprocessor stuff around the function definition.

Not really. A compiler might optimize away the reference to the
symbol if it's say guarded by a condition whose value can be
determined to be false at compile time. If you rely on that, moving
to a different compiler that is unable to compute the condition value,
or simply is pickier as to standard compliance, will get you errors.

--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}