Deprecate C style declerations?
Hasan Aljudy
hasan.aljudy at gmail.com
Wed Dec 20 17:54:06 PST 2006
Gregor Richards wrote:
> Jarrett Billingsley wrote:
>> "Chris Nicholson-Sauls" <ibisbasenji at gmail.com> wrote in message
>> news:emcekr$2sah$1 at digitaldaemon.com...
>>
>>> Should we do this? As in cause:
>>>
>>> # int foo[];
>>> # int bar*;
>>>
>>> And others to issue deprecation errors. I think it would be a good
>>> idea, and shouldn't break extern(C) declarations, so long as one
>>> doesn't try to mix types. (I don't think we can mix them in the C
>>> way at all, anyhow. Haven't tried, though.)
>>
>>
>> I agree, though
>>
>> int bar*;
>>
>> isn't legal any way you slice it, D or C.
>>
>> I'd also be interested in phasing out the C-style function pointer
>> syntax:
>>
>> int (*foo)(int, int);
>> =>
>> int function(int, int) foo;
>>
>>
>>> Or else change the rules such that array/pointer decoration applies
>>> to the variable and not the type -- and correct me if I'm wrong about
>>> this not being the current behavior.
>>>
>>> # int num ,
>>> # arr[] ,
>>> # ptr* ;
>>>
>>> vs
>>>
>>> # int num ;
>>> # int[] arr ;
>>> # int* ptr ;
>>
>>
>> I think that C "feature" was dropped in D because it makes multiple
>> declarations harder to read.
>>
>
> Hear-hear! No need for C's crummy array syntax. Writing support for
> outputting the right C types in bcd.gen was a huge PITA because of it X_X
>
> Hear-hear particularly to deprecating the C function syntax. That syntax
> makes me want to gag myself with a spoon.
>
> - Gregor Richards
Hear hear ..!
I know how you feel!!
I tried to open this subject before, but didn't get anywhere ..
More information about the Digitalmars-d
mailing list