juan via agora-discussion [2025-07-22 13:21]:
> Janet Cobb via agora-discussion [2025-07-21 19:32]:
> > On 7/21/25 19:30, Mischief via agora-discussion wrote:
> > > On 7/21/25 12:09 PM, juan via agora-business wrote:
> > >> Cosmo via agora-official [2025-07-20 23:29]:
> > >>> I initiate a referendum on each of the following proposals, removing
> > >>> them from the proposal pool. […]
> > >> I do the actions specified in the document that is formed by the output
> > >> of the following C program as compiled by the ANSI standard:
> > >>
> > >> {
> > >> main(){char i;for (i = 0; i < 7; i++){printf("I vote FOR %d.\n", 9234 + 
> > >> i);}}
> > >> }
> > > P9240 hasn't been distributed yet.
> > >
> > > (Also, gcc wouldn't compile this as-is for me since it wanted cstdio 
> > > #include'd.)
> > >
> > 
> > Yes, under the standard, this is ill-formed. I think those votes fail.
> […]

Further investigation yielded the same conclusion. Under the C89 standard,
function calls composed of a single identifier that has no declaration act
as if declared as returning an `int`. This is the case for both `main` and
`printf`. See this link: https://stackoverflow.com/a/437763/11672072. I
checked in the actual spec, and the quote is correct.

I suggest verifying your compiler's compliance to spec.

Note: the spec itself gives as an example calling a library function
without declaring it (in §7.1.7, the last example).

-- 
juan

Reply via email to