Re: default function parameters

2005-09-09 Thread Glynn Clements
_z33 wrote: > > Unless you're writing a compiler this does not matter. Even if an int > > argument in implicitly used it has no meaning to the programmer. > > Since void is a well defined type, although an incomplete one, I have > > doubts that int is used internally. I simply can't see the ra

Re: default function parameters

2005-09-09 Thread Glynn Clements
_z33 wrote: >I'm clear... but, now wondering why for two days a guy from an R&D > dept of an MNC is arguing with me, saying that a function with empty > argument specification implies having implicit "int" type arguments. > (similar to the implicit assumption of return type of functions to

Re: default function parameters

2005-09-09 Thread Glynn Clements
_z33 wrote: >I had a wierd doubt today morning. If a function's return type is not > defined, "C" takes it as returning "int". Now, what does it do when I > don't specify the arguments of the function. Something like this - > >void sampleFunc () >{ > /* ... */ >} > >

Re: default function parameters

2005-09-09 Thread Steve Graegert
On 9/9/05, _z33 <[EMAIL PROTECTED]> wrote: > Steve Graegert wrote: > > I have modified the code to clarify my thoughts: > > > > #include > > > > /* prototype */ > > void add(); /* call with arbitrary number of arguments */ > > > > void add (int a, int b, int c) { > >

Re: default function parameters

2005-09-09 Thread _z33
Steve Graegert wrote: Thou *I think* even the C compiler should have given a warning. (Note -Wall does not turn on all warnings, just almost all). try -ansi combined with -pedantic. I'm using "bloodshed developer cpp" compiler (it uses Mingw port of GCC as it's compiler)in windows for the

Re: default function parameters

2005-09-09 Thread _z33
Steve Graegert wrote: I have modified the code to clarify my thoughts: #include /* prototype */ void add(); /* call with arbitrary number of arguments */ void add (int a, int b, int c) { printf ("inside function: add(%d, %d)\n", a, b);

Re: default function parameters

2005-09-09 Thread Steve Graegert
On 9/9/05, Jarmo <[EMAIL PROTECTED]> wrote: > There is a diff in how C and C++ sees this. > > For C add( ) is an function taking undefined argument(s), so you can > send it whatever you want. C++ on other hand will see add( ) as add( > void ), and would complain. To say that add( ) would be equal

Re: default function parameters

2005-09-09 Thread Steve Graegert
On 9/9/05, _z33 <[EMAIL PROTECTED]> wrote: > Steve Graegert wrote: > > > Unless you're writing a compiler this does not matter. Even if an int > > argument in implicitly used it has no meaning to the programmer. > > Since void is a well defined type, although an incomplete one, I have > > doubts

Re: default function parameters

2005-09-09 Thread Jarmo
There is a diff in how C and C++ sees this. For C add( ) is an function taking undefined argument(s), so you can send it whatever you want. C++ on other hand will see add( ) as add( void ), and would complain. To say that add( ) would be equal to add( int(s) ) is bogus thou. In real life thi

Re: default function parameters

2005-09-09 Thread _z33
Steve Graegert wrote: Unless you're writing a compiler this does not matter. Even if an int argument in implicitly used it has no meaning to the programmer. Since void is a well defined type, although an incomplete one, I have doubts that int is used internally. I simply can't see the ration

Re: default function parameters

2005-09-09 Thread Steve Graegert
On 9/9/05, _z33 <[EMAIL PROTECTED]> wrote: > Steve Graegert wrote: > > On 9/9/05, _z33 <[EMAIL PROTECTED]> wrote: > > > >> I had a wierd doubt today morning. If a function's return type is not > >>defined, "C" takes it as returning "int". Now, what does it do when I > >>don't specify the arguments

Re: default function parameters

2005-09-09 Thread _z33
Steve Graegert wrote: On 9/9/05, _z33 <[EMAIL PROTECTED]> wrote: I had a wierd doubt today morning. If a function's return type is not defined, "C" takes it as returning "int". Now, what does it do when I don't specify the arguments of the function. Something like this - void sampleFunc ()

Re: default function parameters

2005-09-08 Thread Steve Graegert
On 9/9/05, _z33 <[EMAIL PROTECTED]> wrote: > I had a wierd doubt today morning. If a function's return type is not > defined, "C" takes it as returning "int". Now, what does it do when I > don't specify the arguments of the function. Something like this - > > void sampleFunc () > { >