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: Henrik Nordstrom
Subject: Re: [Tinycc-devel] Segmentation fault compiling broken 1-liner
Date: Tue, 30 Aug 2005 20:03:21 +0200 (CEST)

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? To my best knowledge that does not make it invalid C. Variable arguments have existed since K&R where function prototypes didn't even exists.. but maybe you are correct and there is some platforms where the ABI requires functions with variable arguments to be called in a different manner than normal functions making this requirement of having them declared before use. But even then it is not invalid C, just incorrect use of the printf function and quite likely to crash at runtime when running the resulting executable due to mismatch between compilation unit and library ABI.

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

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

Regards
Henrik





reply via email to

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