tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Segmentation fault compiling broken 1-liner


From: Antti-Juhani Kaijanaho
Subject: Re: [Tinycc-devel] Segmentation fault compiling broken 1-liner
Date: Wed, 31 Aug 2005 07:36:42 +0300
User-agent: Debian Thunderbird 1.0.6 (X11/20050802)

Henrik Nordstrom wrote:
> On Tue, 30 Aug 2005, Antti-Juhani Kaijanaho wrote:
> 
>> There is no declaration of printf in the file (either included or
>> otherwise), and since printf is a stdarg function, a prototype must be
>> in scope.
> 
> Says who?

Says the C standard (ISO 9899:1999 ยง 6.5.2.2:6).  The behaviour is
undefined in such a case, and that's the standard's way of saying it's a
mortal sin.

> To my best knowledge that does not make it invalid C.

Then your best knowledge is faulty, or at best obsolete.

> Variable
> arguments have existed since K&R where function prototypes didn't even
> exists..

Yes, unportable, unstandardized ways of doing that.  I hope nobody
writes K&R1 C in this day and age.  Even TCC aims for C99 compliance, so
K&R1 C is doubly irrelevant.

> Also the return type is optional, and defaults (per K&R) to int if not
> specified.

That does not contradict what I said.  Implicit int, BTW, is forbidden
by C99.

> The missing () on main does however make it very invalid C.

That's just a syntax violation.

-- 
Antti-Juhani

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]