digitalmars.D - C-style function pointer syntax supported?
- Sean Kelly (12/12) Jan 18 2006 I just noticed this last night:
- John Reimer (6/24) Jan 18 2006 I know the C syntax has been supported for awhile in D. It certainly
- Ameer Armaly (4/16) Jan 18 2006 I would support depricating it, since the D syntax is much more explicit...
- Don Clugston (5/23) Jan 18 2006 At the very least, the D syntax should be the one used in error
I just noticed this last night:
alias void (*t1)();
alias void function() t2;
void fn() {}
void main()
{
t1 f = &fn;
t2 g = &fn;
}
This compiles just fine. Is the C syntax supported to ease porting or
is it an artifact of a bygone day? Should the syntax be deprecated?
Sean
Jan 18 2006
Sean Kelly wrote:
I just noticed this last night:
alias void (*t1)();
alias void function() t2;
void fn() {}
void main()
{
t1 f = &fn;
t2 g = &fn;
}
This compiles just fine. Is the C syntax supported to ease porting or
is it an artifact of a bygone day? Should the syntax be deprecated?
Sean
I know the C syntax has been supported for awhile in D. It certainly
makes header conversion much easier. Yet, I prefer the clarity of the D
style; when I port C code to D, I almost always convert the function
pointers to the D style as well.
-JJR
Jan 18 2006
"Sean Kelly" <sean f4.ca> wrote in message news:dqltqq$125l$1 digitaldaemon.com...I just noticed this last night: alias void (*t1)(); alias void function() t2; void fn() {} void main() { t1 f = &fn; t2 g = &fn; } This compiles just fine. Is the C syntax supported to ease porting or is it an artifact of a bygone day? Should the syntax be deprecated?I would support depricating it, since the D syntax is much more explicit and clear.Sean
Jan 18 2006
Sean Kelly wrote:
I just noticed this last night:
alias void (*t1)();
alias void function() t2;
void fn() {}
void main()
{
t1 f = &fn;
t2 g = &fn;
}
This compiles just fine. Is the C syntax supported to ease porting or
is it an artifact of a bygone day? Should the syntax be deprecated?
Sean
At the very least, the D syntax should be the one used in error
messages. It's a bit silly that an error message involving t2 will
describe it as
void (*t2)()
Jan 18 2006









John Reimer <terminal.node gmail.com> 