Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
May 24, 2005 -release and -debug are not mutually-exclusive? | ||||
---|---|---|---|---|
| ||||
Does not having -debug mode imply -release mode? Does not having -release mode imply -debug mode? It seems there is some intermediate mode here which is neither release nor debug which is causing some headaches with missing _assert functions during linking. I think this needs to be fixed. Either have -release or -debug. Regards, James Dunne |
May 24, 2005 Re: -release and -debug are not mutually-exclusive? | ||||
---|---|---|---|---|
| ||||
Posted in reply to James Dunne | You're misunderstanding the options. I admit this is misleading:
-debug compile in debug code
-release compile release version
But, it's really this simple:
Debug means anything in debug {} sections.
Release means no asserts, no dbc, etc.
No release, no debug means asserts, dbc, etc... but no code in debug {}.
Debug and release means no asserts, no dbc, but code in debug {} compiled in.
So, no - they are not mutually exclusive. They only change the default behavior in different ways.
For a more visual example, this code:
int main()
{
debug printf("hello!");
assert(0);
return 0;
}
When compiled with no paramaters (just dmd test) will fail with an assertion error.
When compiled with -debug, it will say:
hello!
And then fail with an assertion failure.
When compiled with -release, it will output nothing and return to the prompt happy as can be.
When compiled with -release -debug, it will say:
hello!
And then return to the prompt happy as can be, no assertion failure.
-[Unknown]
> Does not having -debug mode imply -release mode?
> Does not having -release mode imply -debug mode?
>
> It seems there is some intermediate mode here which is neither release nor debug
> which is causing some headaches with missing _assert functions during linking.
> I think this needs to be fixed. Either have -release or -debug.
>
> Regards,
> James Dunne
|
May 24, 2005 Re: -release and -debug are not mutually-exclusive? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Unknown W. Brackets | Thank you. That was so clear. You should seriously write documentation. But still, what is with the missing _assert functions? Is this just a phobos compilation problem? In article <d6vg7t$1jqp$1@digitaldaemon.com>, Unknown W. Brackets says... > >You're misunderstanding the options. I admit this is misleading: > > -debug compile in debug code > -release compile release version > >But, it's really this simple: > >Debug means anything in debug {} sections. >Release means no asserts, no dbc, etc. >No release, no debug means asserts, dbc, etc... but no code in debug {}. >Debug and release means no asserts, no dbc, but code in debug {} >compiled in. > >So, no - they are not mutually exclusive. They only change the default behavior in different ways. > >For a more visual example, this code: > >int main() >{ > debug printf("hello!"); > > assert(0); > return 0; >} > >When compiled with no paramaters (just dmd test) will fail with an assertion error. > >When compiled with -debug, it will say: > >hello! > >And then fail with an assertion failure. > >When compiled with -release, it will output nothing and return to the prompt happy as can be. > >When compiled with -release -debug, it will say: > >hello! > >And then return to the prompt happy as can be, no assertion failure. > >-[Unknown] > > >> Does not having -debug mode imply -release mode? >> Does not having -release mode imply -debug mode? >> >> It seems there is some intermediate mode here which is neither release nor debug which is causing some headaches with missing _assert functions during linking. I think this needs to be fixed. Either have -release or -debug. >> >> Regards, >> James Dunne Regards, James Dunne |
May 24, 2005 Re: -release and -debug are not mutually-exclusive? | ||||
---|---|---|---|---|
| ||||
Posted in reply to James Dunne | > Thank you. That was so clear. You should seriously write documentation. Thanks. I'm glad I was able to help, and as it happens I do write (development) documentation ;). For my own project, that is. But mostly I code. > But still, what is with the missing _assert functions? Is this just a phobos > compilation problem? _assert functions? I'm afraid I don't know what you mean. I know there's no _assert, but rather assert (built into the language.) As for phobos, it's compiled in -release mode by default, which imho isn't how I'd like it. Ideally, I would have it use phobos in release only when I compile in release. Maybe "phobos-release.lib"/.a. -[Unknown] |
May 24, 2005 Re: -release and -debug are not mutually-exclusive? | ||||
---|---|---|---|---|
| ||||
Posted in reply to James Dunne | On Tue, 24 May 2005 13:31:06 +0000 (UTC), James Dunne wrote: > Does not having -debug mode imply -release mode? > Does not having -release mode imply -debug mode? > > It seems there is some intermediate mode here which is neither release nor debug which is causing some headaches with missing _assert functions during linking. I think this needs to be fixed. Either have -release or -debug. The -debug switch is poorly named as it is confusing. One tends to think in the release-debug dichotomy, that is, its either one or the other and never both. In fact, the -debug is exactly equivalent to the -version switch in functionality. It is really just another *type* of -version switch. It has no other meaning or usage except to include blocks of code enclosed in 'debug' statements, just like -version is used to include blocks of code enclosed by 'version' statements. The switch "-debug" has no effect on asserts, array-bounds testing, or contracts (or unit tests). It only includes those blocks of code that you have enclosed in debug statements. The switch "-release" effects asserts, array-bounds testing, and contracts (but not unit tests). By default these are all active unless you compile with "-release". The switch "-unittest" causes unittest statement blocks to be compiled in. By default these blocks are not compiled. -- Derek Parnell Melbourne, Australia 25/05/2005 6:50:00 AM |
May 25, 2005 Re: -release and -debug are not mutually-exclusive? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Unknown W. Brackets | In article <d702j1$2aao$1@digitaldaemon.com>, Unknown W. Brackets says... > >> Thank you. That was so clear. You should seriously write documentation. > >Thanks. I'm glad I was able to help, and as it happens I do write (development) documentation ;). For my own project, that is. But mostly I code. > >> But still, what is with the missing _assert functions? Is this just a phobos compilation problem? > >_assert functions? I'm afraid I don't know what you mean. I know there's no _assert, but rather assert (built into the language.) > It's hard to duplicate, but they're linker errors when you forget to compile with -release mode and have asserts in your code I believe. >As for phobos, it's compiled in -release mode by default, which imho isn't how I'd like it. Ideally, I would have it use phobos in release only when I compile in release. Maybe "phobos-release.lib"/.a. > I agree. >-[Unknown] Regards, James Dunne |
May 25, 2005 Re: -release and -debug are not mutually-exclusive? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | In article <55k5c5vx3sib$.17niib7t09wqa$.dlg@40tude.net>, Derek Parnell says... > >On Tue, 24 May 2005 13:31:06 +0000 (UTC), James Dunne wrote: > >> Does not having -debug mode imply -release mode? >> Does not having -release mode imply -debug mode? >> >> It seems there is some intermediate mode here which is neither release nor debug which is causing some headaches with missing _assert functions during linking. I think this needs to be fixed. Either have -release or -debug. > >The -debug switch is poorly named as it is confusing. One tends to think in the release-debug dichotomy, that is, its either one or the other and never both. In fact, the -debug is exactly equivalent to the -version switch in functionality. It is really just another *type* of -version switch. It has no other meaning or usage except to include blocks of code enclosed in 'debug' statements, just like -version is used to include blocks of code enclosed by 'version' statements. > >The switch "-debug" has no effect on asserts, array-bounds testing, or contracts (or unit tests). It only includes those blocks of code that you have enclosed in debug statements. > >The switch "-release" effects asserts, array-bounds testing, and contracts (but not unit tests). By default these are all active unless you compile with "-release". > >The switch "-unittest" causes unittest statement blocks to be compiled in. By default these blocks are not compiled. > >-- >Derek Parnell >Melbourne, Australia >25/05/2005 6:50:00 AM Shouldn't this be changed to the traditional debug/release dichotomy? For example: -debug enables asserts, contracts, debug statements, and array bounds checking. -release disables all asserts, contracts, debug statements, and array bounds checking. and set -debug mode to default. I think this would be clearer. It feels like a 'gotcha' right now. Regards, James Dunne |
May 25, 2005 Re: -release and -debug are not mutually-exclusive? | ||||
---|---|---|---|---|
| ||||
Posted in reply to James Dunne | But, then, what enables sections like this: debug { writef("test!"); } Or are you saying they should just be removed? Or always compiled in? -[Unknown] |
May 25, 2005 Re: -release and -debug are not mutually-exclusive? | ||||
---|---|---|---|---|
| ||||
Posted in reply to James Dunne | On Wed, 25 May 2005 13:37:04 +0000 (UTC), James Dunne wrote: [snip] > > Shouldn't this be changed to the traditional debug/release dichotomy? > > For example: > -debug enables asserts, contracts, debug statements, and array bounds checking. > -release disables all asserts, contracts, debug statements, and array bounds > checking. > > and set -debug mode to default. > > I think this would be clearer. It feels like a 'gotcha' right now. I think that -debug should have been named differently. It's too late now for it to change, I guess, so we just have to live with the confusion it is always going to cause. -- Derek Parnell Melbourne, Australia 26/05/2005 5:49:26 AM |
Copyright © 1999-2021 by the D Language Foundation