www.digitalmars.com         C & C++   DMDScript  

D.gnu - GDC specific bugs

reply "Thomas Kuehne" <thomas-dloop kuehne.cn> writes:
http://svn.kuehne.cn/dstress/run/break_03.d
http://svn.kuehne.cn/dstress/run/break_04.d
http://svn.kuehne.cn/dstress/run/break_05.d
http://svn.kuehne.cn/dstress/nocompile/command_line_deprecated_02.d
http://svn.kuehne.cn/dstress/run/delegate_04.d
http://svn.kuehne.cn/dstress/nocompile/delegate_05.d
http://svn.kuehne.cn/dstress/run/delegate_12.d
http://svn.kuehne.cn/dstress/run/enum_07.d
http://svn.kuehne.cn/dstress/run/enum_08.d
http://svn.kuehne.cn/dstress/run/enum_09.d
http://svn.kuehne.cn/dstress/complex/linking/ (linking_01)
http://svn.kuehne.cn/dstress/nocompile/static_08.d
Dec 11 2004
parent reply John Reimer <brk_6502 yahoo.com> writes:
Thomas Kuehne wrote:
 http://svn.kuehne.cn/dstress/run/break_03.d
 http://svn.kuehne.cn/dstress/run/break_04.d
 http://svn.kuehne.cn/dstress/run/break_05.d
 http://svn.kuehne.cn/dstress/nocompile/command_line_deprecated_02.d
 http://svn.kuehne.cn/dstress/run/delegate_04.d
 http://svn.kuehne.cn/dstress/nocompile/delegate_05.d
 http://svn.kuehne.cn/dstress/run/delegate_12.d
 http://svn.kuehne.cn/dstress/run/enum_07.d
 http://svn.kuehne.cn/dstress/run/enum_08.d
 http://svn.kuehne.cn/dstress/run/enum_09.d
 http://svn.kuehne.cn/dstress/complex/linking/ (linking_01)
 http://svn.kuehne.cn/dstress/nocompile/static_08.d
 
 

For the "enum" stress tests, I notice that a semicolon is used to end the enum declaration. The D standard declares them without a semicolon appended. Would removing the semicolon change the stress test results? - John
Dec 11 2004
parent reply "Thomas Kuehne" <thomas-dloop kuehne.cn> writes:
John Reimer schrieb:
 Thomas Kuehne wrote:
 http://svn.kuehne.cn/dstress/run/break_03.d
 http://svn.kuehne.cn/dstress/run/break_04.d
 http://svn.kuehne.cn/dstress/run/break_05.d
 http://svn.kuehne.cn/dstress/nocompile/command_line_deprecated_02.d
 http://svn.kuehne.cn/dstress/run/delegate_04.d
 http://svn.kuehne.cn/dstress/nocompile/delegate_05.d
 http://svn.kuehne.cn/dstress/run/delegate_12.d
 http://svn.kuehne.cn/dstress/run/enum_07.d
 http://svn.kuehne.cn/dstress/run/enum_08.d
 http://svn.kuehne.cn/dstress/run/enum_09.d
 http://svn.kuehne.cn/dstress/complex/linking/ (linking_01)
 http://svn.kuehne.cn/dstress/nocompile/static_08.d


 For the "enum" stress tests, I notice that a semicolon is used to end
 the enum declaration.  The D standard declares them without a semicolon
 appended.  Would removing the semicolon change the stress test results?

Thanks, I removed the semicolon. The change had no impact. Thomas
Dec 12 2004
next sibling parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Thomas Kuehne wrote:

For the "enum" stress tests, I notice that a semicolon is used to end
the enum declaration.  The D standard declares them without a semicolon
appended.  Would removing the semicolon change the stress test results?

Thanks, I removed the semicolon. The change had no impact.

If D had supported warnings, it would probably be appropriate to issue one for extra semicolons after enum and class and such... But since it doesn't, it's really not enough to trigger an error. Maybe it (D) does need some kind of -pedantic flag, like GCC has ? "verify program according to the standard and strict specification" (do some "lint" checks that takes forever but sometimes catches bugs?) --anders
Dec 12 2004
parent reply "Thomas Kuehne" <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Anders schrieb:
For the "enum" stress tests, I notice that a semicolon is used to end
the enum declaration.  The D standard declares them without a semicolon
appended.  Would removing the semicolon change the stress test results?

Thanks, I removed the semicolon. The change had no impact.

If D had supported warnings, it would probably be appropriate to issue one for extra semicolons after enum and class and such... But since it doesn't, it's really not enough to trigger an error. Maybe it (D) does need some kind of -pedantic flag, like GCC has ? "verify program according to the standard and strict specification" (do some "lint" checks that takes forever but sometimes catches bugs?)

http://digitalmars.com/d/statement.html#expression # Expressions that have no affect, like (x + x), are illegal in expression # statements. "" (empty) has no affect, thus it's illegal. Thomas diff -ur dmd-109/dmd/src/dmd/parse.c neu/dmd/src/dmd/parse.c - --- dmd-109/dmd/src/dmd/parse.c 2004-12-03 01:19:56.000000000 +0100 +++ neu/dmd/src/dmd/parse.c 2004-12-12 12:15:46.857412128 +0100 -475,6 +475,7 } case TOKsemicolon: // empty declaration + error("empty declaration in front of semicolon"); nextToken(); continue; -----BEGIN PGP SIGNATURE----- iD8DBQFBvCzc3w+/yD4P9tIRAhoYAKCbExq/KOoPmFi7f3k+JRrBQV2etACZAQ6X tew9aHPuIHwvu+5Sb0UYDFE= =UsUD -----END PGP SIGNATURE-----
Dec 12 2004
parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Thomas Kuehne wrote:

 http://digitalmars.com/d/statement.html#expression
 # Expressions that have no affect, like (x + x), are illegal in expression
 # statements.
 
 "" (empty) has no affect, thus it's illegal.

True, then it *should* be made into an error after all... Right now there seems to be NO such warnings implemented in GDC:
 void main()
 {
 };

 void main()
 {
   ;
 }

 void main()
 {
   null;
 }

 void main()
 {
   int x;
   (x + x);
 }

GCC says "warning: statement with no effect" for 3) and 4) above (i.e. for the C versions of them, changed to "int main()") and for 1) "warning: ISO C does not allow extra `;' outside of a function" Losing the extra semicolon after *some* declarations is a Good Thing, even if it makes it C-incompatible ? (a little like functions with no arguments, or casts) --anders
Dec 12 2004
prev sibling parent reply John Reimer <brk_6502 yahoo.com> writes:
Thomas Kuehne wrote:
 John Reimer schrieb:
 
Thomas Kuehne wrote:

http://svn.kuehne.cn/dstress/run/break_03.d
http://svn.kuehne.cn/dstress/run/break_04.d
http://svn.kuehne.cn/dstress/run/break_05.d
http://svn.kuehne.cn/dstress/nocompile/command_line_deprecated_02.d
http://svn.kuehne.cn/dstress/run/delegate_04.d
http://svn.kuehne.cn/dstress/nocompile/delegate_05.d
http://svn.kuehne.cn/dstress/run/delegate_12.d
http://svn.kuehne.cn/dstress/run/enum_07.d
http://svn.kuehne.cn/dstress/run/enum_08.d
http://svn.kuehne.cn/dstress/run/enum_09.d
http://svn.kuehne.cn/dstress/complex/linking/ (linking_01)
http://svn.kuehne.cn/dstress/nocompile/static_08.d


For the "enum" stress tests, I notice that a semicolon is used to end
the enum declaration.  The D standard declares them without a semicolon
appended.  Would removing the semicolon change the stress test results?

Thanks, I removed the semicolon. The change had no impact. Thomas

Perhaps the semicolon is indeed optional. I now see that the D language docs actual use a semicolon to end an enum in some examples, although it doesn't seem to appear in the actual enum definition portion of the docs. I guess it's probably just one of those C carry-over features. - John
Dec 12 2004
parent reply J C Calvarese <jcc7 cox.net> writes:
John Reimer wrote:
 Thomas Kuehne wrote:
 
 Thanks, I removed the semicolon. The change had no impact.

 Thomas

Perhaps the semicolon is indeed optional. I now see that the D language docs actual use a semicolon to end an enum in some examples, although it doesn't seem to appear in the actual enum definition portion of the docs. I guess it's probably just one of those C carry-over features. - John

As far as I can tell DMD doesn't care if you have empty statements (just as comments are ignored). I don't have a problem with that. If you're relying on ";" to do something, I don't think a warning or an error is going to help you much. On the other hand, I understand why "int i; i;" should be disallowed. I can see all kinds of bugs that can be prevented by prohibiting that. By the way, DMD compiles the following code without complaint: ; ; ; enum { item1, item2, item3 } enum { a, b, c }; int main() { ; ; return 1; } My two cents... -- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/
Dec 13 2004
parent John Reimer <brk_6502 yahoo.com> writes:
Hello Justin,

Yeah... you are probably right.  D's flexibility with spurious 
semicolons is probably not something to lose sleep over. :-)

- John

J C Calvarese wrote:
 John Reimer wrote:
 
 Thomas Kuehne wrote:

 Thanks, I removed the semicolon. The change had no impact.

 Thomas

Perhaps the semicolon is indeed optional. I now see that the D language docs actual use a semicolon to end an enum in some examples, although it doesn't seem to appear in the actual enum definition portion of the docs. I guess it's probably just one of those C carry-over features. - John

As far as I can tell DMD doesn't care if you have empty statements (just as comments are ignored). I don't have a problem with that. If you're relying on ";" to do something, I don't think a warning or an error is going to help you much. On the other hand, I understand why "int i; i;" should be disallowed. I can see all kinds of bugs that can be prevented by prohibiting that. By the way, DMD compiles the following code without complaint: ; ; ; enum { item1, item2, item3 } enum { a, b, c }; int main() { ; ; return 1; } My two cents...

Dec 13 2004