C compatibility

grauzone none at example.net
Wed Jul 15 01:47:31 PDT 2009


BCS wrote:
> Reply to Jacob,
> 
>> I've read posts in several threads complaining about the C
>> compatibility, the latest was the % operator. Other complains are that
>> you can use the C syntax for pointers, arrays and function pointers.
>> Also the "Case range statement" thread that complained (among other
>> things) about fall through in switch statements.
>>
>> Why not the drop this C compatibility in general case
> 
> 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.

But what for?
- For headers, you can't include use the C source directly, because 
there are far too many preprocessor directives. Also, headers consist 
mostly of declarations, and not function bodies.
- Normal code you can simply compile in C and link to D. This works 
perfectly fine. There's no real reason to port it to D. And who ports 
large portions of code from C to D anyway?
- There's already code, that compiles with in D1 and D2, but has 
slightly different semantics. (Um, don't ask me for examples.) Why is 
compatibility to C more important than compatibility within the same 
language?



More information about the Digitalmars-d mailing list