digitalmars.D - C-style function pointer syntax supported?
- Sean Kelly <sean f4.ca> Jan 18 2006
- John Reimer <terminal.node gmail.com> Jan 18 2006
- "Ameer Armaly" <ameer_armaly hotmail.com> Jan 18 2006
- Don Clugston <dac nospam.com.au> Jan 18 2006
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?
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> 