function calls, mandatory compiler promotion of int arguments tosize_t?

S

s0suk3

So is

int WINAPI WinMain(HINSTANCE instance, HINSTANCE previnst__,
PSTR cmdline, int showmode)

but you wouldn't recommend that as a sensible form of the main program
to be posted to this newsgroup, would you?

Well, that's not main(); that's WinMain(), so it wouldn't work even if
it would be prototyped 'int WinMain(void)'.

Sebastian
 
R

Richard Bos

Well, that's not main(); that's WinMain(), so it wouldn't work even if
it would be prototyped 'int WinMain(void)'.

Well, surprisingly enough, there's nothing in the Standard that forbids
you from writing

int WINAPI main(HINSTANCE instance, HINSTANCE previnst__,
PSTR cmdline, int showmode)

Richard
 
N

Nick Keighley

   (void) fwrite(buffer, size, count, stdout);

Tells the compiler (and anybody reading the program) that the return
value is intentionally being ignored.  Leave that off and in their
pickier modes many compilers will issue a warning about the unused
return value.

I haven't come across one that did that for quite a while.
And even then I thought it was Lint rather than a compiler.
Personnally I'd stop using a compiler (or compiler mode)
that did that.
 
C

CBFalconer

Nick said:
I haven't come across one that did that for quite a while.
And even then I thought it was Lint rather than a compiler.
Personnally I'd stop using a compiler (or compiler mode)
that did that.

Actually if they all did that we would save a lot of effort telling
newbies to check the response of scanf, fclose, etc. And, if
something goes wrong, the presence of that (void) encourages
getting the actual response and checking it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top