digitalmars.D.bugs - [DMD 0.118] 'switch ' crtical bug,
- Andrew Fedoniouk (37/37) Mar 14 2005 This program below ends abnormally with the message:
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (6/14) Mar 14 2005 Yes, and even the (-w) warning goes away.
- Andrew Fedoniouk (11/25) Mar 14 2005 Thanks Anders.
- Walter (7/10) Mar 14 2005 Yes, that's expected behavior in D. Unlike C, there is no implied
- Andrew Fedoniouk (8/13) Mar 14 2005 Thanks, Walter.
- Derek Parnell (14/20) Mar 14 2005 My guess is that nearly all compiles are done to create an edition of th...
- Walter (4/10) Mar 14 2005 that
- Andrew Fedoniouk (7/19) Mar 14 2005 Sure :) I guess that definition of compiler option should state:
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (8/16) Mar 14 2005 The thing is that -debug and -release are *unrelated* options.
This program below ends abnormally with the message: C:\d\test>test.exe Error: Switch Default test(21) If you will add default: break; in the switch everything will be fine. Either compiler shall report "no default" either it shall not generate an error in runtime. Andrew. === test.d ================================================= import std.stdio; enum DRAW: uint // drawChars flags { LEFT = 0x0, CENTER = 0x1, RIGHT = 0x2, TOP = 0x00, MIDDLE = 0x10, BOTTOM = 0x20, END_ELLIPSIS = 0x100, PATH_ELLIPSIS = 0x200, WORD_ELLIPSIS = 0x300, } int main(char[][] args) { uint f = 0x10; switch( f & 0xF00 ) { case DRAW.END_ELLIPSIS: writef("END_ELLIPSIS\n"); break; case DRAW.PATH_ELLIPSIS: writef("PATH_ELLIPSIS\n"); break; case DRAW.WORD_ELLIPSIS: writef("WORD_ELLIPSIS\n"); break; } return 0; }
Mar 14 2005
Andrew Fedoniouk wrote:This program below ends abnormally with the message: C:\d\test>test.exe Error: Switch Default test(21)It disappears in -release mode, though...If you will add default: break; in the switch everything will be fine.Yes, and even the (-w) warning goes away.Either compiler shall report "no default" either it shall not generate an error in runtime.This is a known behaviour, though (not a bug). See also: http://www.prowiki.org/wiki4d/wiki.cgi?ShortFrequentAnswers --anders
Mar 14 2005
Thanks Anders. I guess we should add there "no return value" issue also. Like: Rect place(Rect r) { _place = r; } will also generate an exception in debug but will compile fine. Andrew. "Anders F Björklund" <afb algonet.se> wrote in message news:d154md$2md5$3 digitaldaemon.com...Andrew Fedoniouk wrote:This program below ends abnormally with the message: C:\d\test>test.exe Error: Switch Default test(21)It disappears in -release mode, though...If you will add default: break; in the switch everything will be fine.Yes, and even the (-w) warning goes away.Either compiler shall report "no default" either it shall not generate an error in runtime.This is a known behaviour, though (not a bug). See also: http://www.prowiki.org/wiki4d/wiki.cgi?ShortFrequentAnswers --anders
Mar 14 2005
"Andrew Fedoniouk" <news terrainformatica.com> wrote in message news:d1549k$2o21$1 digitaldaemon.com...This program below ends abnormally with the message: C:\d\test>test.exe Error: Switch Default test(21)Yes, that's expected behavior in D. Unlike C, there is no implied default: break; inserted in a switch statement without an explicit break. D will insert an implicit default: throw new SwitchError();
Mar 14 2005
Yes, that's expected behavior in D. Unlike C, there is no implied default: break; inserted in a switch statement without an explicit break. D will insert an implicit default: throw new SwitchError();Thanks, Walter. My assumption was that command line: dmd.exe test.d will produce release version. That was wrong (why, btw?). It produces debug version and so I am getting new SwitchError(); And only if I explicitly say "-release" then it disappears. Andrew.
Mar 14 2005
On Mon, 14 Mar 2005 19:03:46 -0800, Andrew Fedoniouk wrote: [snip]My assumption was that command line: dmd.exe test.d will produce release version. That was wrong (why, btw?).My guess is that nearly all compiles are done to create an edition of the application that is about to undergo testing, as opposed to an edition that is destined for an end-user. (Except, of course, if you're MS :D ) So, one would only use the -release option to create the edition that will be used for User Acceptance Testing or similar, and that will be used to create shippable copies of the application. -- Derek Parnell Melbourne, Australia http://www.dsource.org/projects/build/ http://www.prowiki.org/wiki4d/wiki.cgi?FrontPage 15/03/2005 2:33:08 PM
Mar 14 2005
"Derek Parnell" <derek psych.ward> wrote in message news:1gfotxu9j0id.g73pfkq3o5f2.dlg 40tude.net...My guess is that nearly all compiles are done to create an edition of the application that is about to undergo testing, as opposed to an editionthatis destined for an end-user. (Except, of course, if you're MS :D ) So, one would only use the -release option to create the edition that will be used for User Acceptance Testing or similar, and that will be used to create shippable copies of the application.Yes.
Mar 14 2005
"Walter" <newshound digitalmars.com> wrote in message news:d15ljm$5s6$1 digitaldaemon.com..."Derek Parnell" <derek psych.ward> wrote in message news:1gfotxu9j0id.g73pfkq3o5f2.dlg 40tude.net...Sure :) I guess that definition of compiler option should state: -debug compile in debug code (default option) (default option) - is my addon.... If you don't mind to catch someone else on this....My guess is that nearly all compiles are done to create an edition of the application that is about to undergo testing, as opposed to an editionthatis destined for an end-user. (Except, of course, if you're MS :D ) So, one would only use the -release option to create the edition that will be used for User Acceptance Testing or similar, and that will be used to create shippable copies of the application.Yes.
Mar 14 2005
Andrew Fedoniouk wrote:Sure :) I guess that definition of compiler option should state: -debug compile in debug code (default option) (default option) - is my addon.... If you don't mind to catch someone else on this....The thing is that -debug and -release are *unrelated* options. -debug activates a "version" (i.e. the debug { } code areas), while -release removes contracts and switch/bounds checking Then there are also the -g and -O flags too, which are also semi-related but totally different. And of course -inline... And yes, it's a little confusing (at least at first) --anders
Mar 14 2005