On 3/03/2011, at 6:14 AM, Derek M Jones wrote:
> As a compiler writer I don't regard printf as being part of the language
> but as part of the library.

Note however that there are C compilers which, given a call to
{sn,s,f,}printf() with a string literal for the format, will
check that the following arguments conform in number and type
to what the format expects.  This is enormously helpful for the
programmer because there _are_ often bugs of that kind and it
is 100% OK by the standards for C compilers to do checks like

There are things in the library, notably "type generic math",
which require *something* beyond what a compiler that knows only
what is defined elsewhere in the standard to process correctly.
It could be some special magic non-standard syntax or it could
simply be special knowledge built into the compiler that is
activated by including a particular header, but the existence of
*interfaces* in the library that cannot be defined in the
"language" means that compiler writers CANNOT treat (all of)
the library as "not part of the language".

This is not unlike the way that certain fossilised phrases in
English use non-standard syntax, like "court martial", the
structure "<noun> <adjective>" not being the way English normally
does things.

I suppose I don't need to point out, but I shall anyway, that
unlike Pascal or Ada, where keywords are unavailable to the
programmer, C lets you use keywords as variable names:

        #define else ElSe
        int else = 42;
        printf("%d\n", else);
        #undef else

The Open University is incorporated by Royal Charter (RC 000391), an exempt 
charity in England & Wales and a charity registered in Scotland (SC 038302).

Reply via email to