Re: make compilation fail
- From: "Peter Nilsson" <airia@xxxxxxxxxxx>
- Date: 4 May 2005 21:00:59 -0700
CBFalconer wrote:
> Malcolm wrote:
> > ...
> > It's the other way round. In the olden days, it was sometimes
> > the done thing to call functions without a prototype. It is still
> > possible to do this in some cases for reasons of backwards
> > compatibility, but things have tightened up. Current thinking is
> > that prototypes are desireable and compilers should complain if
> > not given them. Certainly you should always include stdio.h if
> > you
> > wnat to use printf().
>
> Not only should, but must. Using any variadic function without a
> prototype in scope results in undefined behaviour.
You don't _have_ to include <stdio.h> to get a prototype for
printf...
int printf(const char *, ...);
int main(void)
{
printf("%s %s\n", "Hello", "World");
return 0;
}
This is valid in C99 too, even though the first parameter of
printf is normally restrict qualified.
--
Peter
.
- References:
- make compilation fail
- From: star_night
- Re: make compilation fail
- From: Malcolm
- Re: make compilation fail
- From: CBFalconer
- make compilation fail
- Prev by Date: Re: void pointer cast segfaults
- Next by Date: Re: void pointer cast segfaults
- Previous by thread: Re: make compilation fail
- Next by thread: Make stronger protection for your software products
- Index(es):
Relevant Pages
|