Re: no previous prototype for function that is defined in header?
Re: no previous prototype for function that is defined in header?
- Subject: Re: no previous prototype for function that is defined in header?
- From: Marc Respass <email@hidden>
- Date: Fri, 28 Jan 2011 17:26:59 -0500
El Jan 28, 2011, a las 5:13 PM, Mark Wagner escribió:
> On Tue, Jan 25, 2011 at 14:17, Marc Respass <email@hidden> wrote:
>
>> While I was responding, I was trying various things. I changed my function from foo() to foo(void) and that fixed it. I feel like such a schmuck. I even have my K & R book out but didn't find the answer. Maybe years of Java have replaced my C knowledge but I didn't realize that I had to have "void" in a method that takes no arguments. I checked the C Language Dialect and it's set to GNU99.
>>
>
> In standard C, foo() is a function that takes an arbitrary number of
> parameters. foo(void) is a function that takes zero parameters. The
> distinction is usually academic, but there is the occasional case
> where it matters.
>
> C++ changes this: foo() and foo(void) are both functions that take
> zero parameters.
>
> I don't know how Objective-C and Objective-C++ handle things.
It seems to be determined by the C Language Dialect (GCC_C_LANGUAGE_STANDARD). A friend pointed out that C99 requires the void and I am set to use GNU99 with Objective-C (not obj-c++). Truth is that I didn't spend a lot of time doing C before starting with Objective-C and I so rarely need to do C programming that things like this throw me.
Thanks for the responses
Marc _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden