February 28, 2003 Re: DMD 0.57 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | Function pointers don't print diagnostics using the new syntax, such as with: void main () { void delegate () foo; static void bar () { } foo = bar; } Prints "cannot implicitly convert void(*)() to void delegate()". |
February 28, 2003 Re: DMD 0.57 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | This one is longstanding. f.d: import g; void main () { printf ("%d\n", foo); // "foo" shouldn't be imported! } g.d: static int foo; So "static" is being ignored. Now would be a good time to move to "private" to mean the same thing instead, and to make applying "static" to a symbol at the module level an error. I think it would be a good idea, anyway. I would also like the change where "protected" means that the symbol isn't imported, but it IS accessible by using the module name. |
February 28, 2003 Re: DMD 0.57 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Burton Radons | Burton Radons <loth@users.sourceforge.net> wrote in news:b3ml3m$25bi$1 @digitaldaemon.com:
> I would also like the change where "protected" means that the symbol isn't imported, but it IS accessible by using the module name.
I'll vote for this too.
|
February 28, 2003 Re: DMD 0.57 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Burton Radons | "Burton Radons" <loth@users.sourceforge.net> wrote in message news:b3ml3m$25bi$1@digitaldaemon.com... > This one is longstanding. > > f.d: > import g; > > void main () > { > printf ("%d\n", foo); // "foo" shouldn't be imported! > } > > g.d: > static int foo; > > So "static" is being ignored. Now would be a good time to move to "private" to mean the same thing instead, It already does. > and to make applying "static" > to a symbol at the module level an error. At the moment, it's a no-op. |
February 28, 2003 Re: DMD 0.57 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | Walter wrote:
> "Burton Radons" <loth@users.sourceforge.net> wrote in message
> news:b3ml3m$25bi$1@digitaldaemon.com...
>
>>So "static" is being ignored. Now would be a good time to move to
>>"private" to mean the same thing instead,
>
> It already does.
Ack, there're places in Phobos which assume that static has the C meaning then: crc32.d (crc32_table), regexp.d (isword, inf, replace3), and stream.d (iswhite, isdigit, isoctdigit, ishexdigit).
|
February 28, 2003 Re: DMD 0.57 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | Weird bug with static: struct foo { static struct bar { int x; } } void main () { printf ("%d\n", foo.bar.size); } This prints 1, rather than 4! |
February 28, 2003 Re: DMD 0.57 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <walter@digitalmars.com> wrote in news:b3fdlo$kp1$1 @digitaldaemon.com:
> Some long overdue features.
>
> www.digitalmars.com/d/changelog.html
>
The following program prints:
12,14
1244952,14
What's with the value of i in the
nested fuction?
void foo(void delegate() baz)
{
baz();
}
void bar(int i)
{
int j = 14;
printf("%d,%d\n",i,j);
void fred()
{
printf("%d,%d\n",i,j);
}
foo(&fred);
}
int main(char[][] argv)
{
bar(12);
return 0;
}
|
February 28, 2003 Re: DMD 0.57 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | Now with nested and inline functions: int foo () { return 0x12345678; } void main () { int nestedFunction () { return foo (); } printf ("%08X\n", foo ()); printf ("%08X\n", nestedFunction ()); printf ("%08X\n", delegate int () { return foo (); }); } This prints: 12345678 12345678 0012FF1C Replacing "delegate" with "function" prints "0040305C". |
February 28, 2003 Re: DMD 0.57 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Burton Radons | Burton Radons wrote:
> printf ("%08X\n", delegate int () { return foo (); });
Gah, I'm a stupidhead. Sorry.
|
February 28, 2003 Re: DMD 0.57 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Patrick Down | Patrick Down <pat@codemoon.com> wrote in news:Xns932FF17C3FB85patcodemooncom@63.105.9.61: > "Walter" <walter@digitalmars.com> wrote in news:b3fdlo$kp1$1 @digitaldaemon.com: > >> Some long overdue features. >> >> www.digitalmars.com/d/changelog.html >> > > The following program prints: > 12,14 > 1244952,14 > > What's with the value of i in the > nested fuction? > > void foo(void delegate() baz) > { > baz(); > } > > void bar(int i) > { > int j = 14; > printf("%d,%d\n",i,j); > > void fred() > { > printf("%d,%d\n",i,j); > } > > foo(&fred); > } > > int main(char[][] argv) > { > bar(12); > > return 0; > } Similar example. i and j are messed up in this one. void frelled(void delegate() baz) { baz(); } class Foo { void bar(int i) { int j = 14; printf("%d,%d\n",i,j); void fred() { printf("%d,%d\n",i,j); } frelled(&fred); } } int main(char[][] argv) { Foo f = new Foo(); f.bar(12); return 0; } |
Copyright © 1999-2021 by the D Language Foundation