K&R-style variadic functions

Regan Heath regan at netmail.co.nz
Wed Jul 18 03:21:04 PDT 2012


On Tue, 17 Jul 2012 20:31:19 +0100, Jacob Carlborg <doob at me.com> wrote:

> On 2012-07-17 17:11, Regan Heath wrote:
>
>> Ahh, I've been looking at the ANSI C spec and assuming that is what
>> you're basing things off, K&R C was pre-ANSI C and may have different
>> rules.  I think you should probably aim to be ANSI C compliant and
>> above, and ignore K&R.
>
> This page says otherwise:
>
> http://en.wikipedia.org/wiki/ANSI_C#Compliance_detectability
>
> "...while an obsolescent non-prototype declaration is used otherwise.  
> Those are still ANSI-compliant as of C99 and C90, but their use is  
> discouraged".

The full quote:

"In the above example, a prototype is used in a function declaration for  
ANSI compliant implementations, while an obsolescent non-prototype  
declaration is used otherwise. Those are still ANSI-compliant as of C99  
and C90, but their use is discouraged."

1) "a prototype is used in a function declaration for ANSI compliant  
implementations"
implies an ANSI compliant compiler /requires/ the full prototype.

2) "obsolescent non-prototype declaration is used otherwise"
implies non-prototype forms are /obsolete/

3) "Those are still"
what is being referred to by the word "those" in that sentence, it's not  
immediately clear to me.  It could mean the non-prototype (as you've  
assumed) but it might also mean the entire construct (using "#if  
__STDC__").

R

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/


More information about the Digitalmars-d mailing list