Discovery!

So, at ~22 hours in I made a discovery about C.

Personally, I am a fan of forward declaring all of my functions for code readability, and have only just found out that:

<type> foo(<type>, <type>, …);

<type> foo(<var>, <var>, …)

{ … }

Is legal code where I have been using:

<type> foo(<type>, <type>, …);

<type> foo(<type> <var>, <type> <var>, …)

{ … }
Are there strong opinions on which is better practice? And what are the arguments for them?

Personally I lean towards the former style – it looks more elegant to me.

Comments

KamiKaziKarl
17. Dec 2011 · 22:42 UTC
declaring the will prevent you from passing an invalid argument. Other than that, it really doesnt seem like a problem either way to me.
17. Dec 2011 · 22:50 UTC
I vaguely remember seeing an old piece of code from the era of Macs with System 6 doing this, which is also valid C: