Deprecate C style declerations?
Jarrett Billingsley
kb3ctd2 at yahoo.com
Wed Dec 20 15:02:09 PST 2006
"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.
More information about the Digitalmars-d
mailing list