This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: (printf) ("hello world\n");


Segher Boessenkool <segher@kernel.crashing.org> writes:

> On 10-dec-03, at 14:36, Joseph S. Myers wrote:
>> On Wed, 10 Dec 2003, Segher Boessenkool wrote:
>>> On 10-dec-03, at 13:27, Robert Dewar wrote:
>>>> Is it really true that the name printf is reserved? Is a C program not
>>>> allowed to define its own printf function (which might or might not be
>>>> varargs)? What's the story here?
>>>
>>> It is reserved only in translation units that have stdio.h #include'd.
>>
>> It is reserved (in a hosted environment) as an identifier with external
>> linkage regardless of what headers are included (7.1.3#1).
>
> That does not prevent you from declaring and defining your own
> printf() function (with a different prototype) though; it only requires
> that you make that function have external linkage.

Which requires that you declare it in the first place, otherwise it will
have implicitly external linkage.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]