C compatibility

Ellery Newcomer ellery-newcomer at utulsa.edu
Tue Jul 14 21:59:32 PDT 2009


Walter Bright wrote:
> Robert Fraser wrote:
>> BCS wrote:
>>> One thing Walter is adement about is that copy-n-paste C code must
>>> run correctly (i.e the same) in D or not compile. As for the C style
>>> type syntax, I'd be willing to see that go en-total.
>>
>> It's useful if you have a .h that you both include in a C/C++ file and
>> run through a preprocessor to output a .d file.
> 
> I agree:
> 
> http://www.digitalmars.com/d/2.0/htod.html

>From DMD's source (parse.c, Parser::isDeclarator):

/* Regard ( identifier ) as not a declarator
 * BUG: what about ( *identifier ) in
 *      f(*p)(x);
 * where f is a class instance with overloaded () ?
 * Should we just disallow C-style function pointer declarations?
 */

I guess the answer to that question would be no.



More information about the Digitalmars-d mailing list