Re: nested comments

2011-05-30 Thread Jonathan M Davis
On 2011-05-30 19:53, Nick Sabalausky wrote: > "Ary Manzana" wrote in message > news:is1hsa$p53$1...@digitalmars.com... > > > On 5/31/11 7:58 AM, Nick Sabalausky wrote: > >> "bearophile" wrote in message > >> news:is1dj6$ihb$1...@digitalmars.com... > >> > >>> Jesse Phillips: > The purpose i

Re: nested comments

2011-05-30 Thread Nick Sabalausky
"Ary Manzana" wrote in message news:is1hsa$p53$1...@digitalmars.com... > On 5/31/11 7:58 AM, Nick Sabalausky wrote: >> "bearophile" wrote in message >> news:is1dj6$ihb$1...@digitalmars.com... >>> Jesse Phillips: >>> The purpose is commenting out code, but note that there is also versio

Re: nested comments

2011-05-30 Thread Jonathan M Davis
On 2011-05-30 18:52, Ary Manzana wrote: > On 5/31/11 7:58 AM, Nick Sabalausky wrote: > > "bearophile" wrote in message > > news:is1dj6$ihb$1...@digitalmars.com... > > > >> Jesse Phillips: > >>> The purpose is commenting out code, but note that there is also > >>> version(none) { } which is never

Re: nested comments

2011-05-30 Thread bearophile
Jonathan M Davis: > What _is_ a bad idea is leaving in sections of commented out code when you > check in code.< Right, that's what I meant. Commenting out parts is fine while you are fixing or writing code. Bye, bearophile

Re: nested comments

2011-05-30 Thread Ary Manzana
On 5/31/11 7:58 AM, Nick Sabalausky wrote: "bearophile" wrote in message news:is1dj6$ihb$1...@digitalmars.com... Jesse Phillips: The purpose is commenting out code, but note that there is also version(none) { } which is never compiled in. version(none) {} is probably the official way to com

Re: nested comments

2011-05-30 Thread Jonathan M Davis
On 2011-05-30 17:43, bearophile wrote: > Jesse Phillips: > > The purpose is commenting out code, but note that there is also > > version(none) { } which is never compiled in. > > version(none) {} is probably the official way to comment out code. > And if you use a versioning system to keep your co

Re: nested comments

2011-05-30 Thread Nick Sabalausky
"bearophile" wrote in message news:is1dj6$ihb$1...@digitalmars.com... > Jesse Phillips: > >> The purpose is commenting out code, but note that there is also >> version(none) { } which is never compiled in. > > version(none) {} is probably the official way to comment out code. > And if you use a

Re: nested comments

2011-05-30 Thread bearophile
Jesse Phillips: > The purpose is commenting out code, but note that there is also version(none) > { } which is never compiled in. version(none) {} is probably the official way to comment out code. And if you use a versioning system to keep your code, then commenting out code is not a so wise th

Re: nested comments

2011-05-30 Thread Jesse Phillips
%u Wrote: > what is the purpose of nested comments ? The purpose is commenting out code, but note that there is also version(none) { } which is never compiled in.

Re: Assert allowed to have side effects?

2011-05-30 Thread bearophile
Stewart Gordon: > Only if purity rules are relaxed. AIUI, one of the restrictions at the > moment is that in > a pure function only immutable data can be accessed. As long as this > restriction remains > in place, adding the restriction of purity to asserts would erode their > usefulness.

Re: Assert allowed to have side effects?

2011-05-30 Thread David Nadlinger
On 5/31/11 1:34 AM, Stewart Gordon wrote: On 29/05/2011 14:03, bearophile wrote: Stewart Gordon: There are places where the spec fails to make a clear distinction between illegal code and incorrect code that the compiler may reject if it's smart enough. In D there are pure functions, so I th

Re: Assert allowed to have side effects?

2011-05-30 Thread Jonathan M Davis
On 2011-05-30 16:34, Stewart Gordon wrote: > On 29/05/2011 14:03, bearophile wrote: > > Stewart Gordon: > >> There are places where the spec fails to make a clear distinction > >> between illegal code and incorrect code that the compiler may reject if > >> it's smart enough. > > > > In D there are

Re: Assert allowed to have side effects?

2011-05-30 Thread Stewart Gordon
On 29/05/2011 14:03, bearophile wrote: Stewart Gordon: There are places where the spec fails to make a clear distinction between illegal code and incorrect code that the compiler may reject if it's smart enough. In D there are pure functions, so I think it's not too much hard for it to tell

Re: nested comments

2011-05-30 Thread %u
I understand it thanks

Re: nested comments

2011-05-30 Thread Timon Gehr
> commenting out code?? example please /+ /* this is code: */ int more_code; // more code code(more_code+even_more_code(1321)); +/

Re: nested comments

2011-05-30 Thread %u
commenting out code?? example please

Re: Helping the compiler with assumptions while using exceptions

2011-05-30 Thread Timon Gehr
> Timon Gehr: > >> The answer is yes, theoretically it could. (It would either have to have >> some very >> advanced code analysis caps, or would just have to treat enforce specially.) > > Id's not so advanced stuff. > > Bye, > bearophile You are saying that analyzing a function for thrown except

Re: Helping the compiler with assumptions while using exceptions

2011-05-30 Thread Jonathan M Davis
On 2011-05-30 15:03, Brad Roberts wrote: > On 5/30/2011 2:55 PM, Jonathan M Davis wrote: > > I'd be very surprised to see the compiler ever optimize code based on > > assert or enforce statement. It's unlikely to do so based on assert > > simply because the assertion is going to be compiled out. I

Re: Helping the compiler with assumptions while using exceptions

2011-05-30 Thread Brad Roberts
On 5/30/2011 2:55 PM, Jonathan M Davis wrote: > I'd be very surprised to see the compiler ever optimize code based on assert > or enforce statement. It's unlikely to do so based on assert simply because > the assertion is going to be compiled out. I think that there's a high chance > that optim

Re: Helping the compiler with assumptions while using exceptions

2011-05-30 Thread bearophile
Timon Gehr: > The answer is yes, theoretically it could. (It would either have to have some > very > advanced code analysis caps, or would just have to treat enforce specially.) Id's not so advanced stuff. Bye, bearophile

Re: Helping the compiler with assumptions while using exceptions

2011-05-30 Thread Jonathan M Davis
On 2011-05-30 14:39, Timon Gehr wrote: > Jonathan M Davis wrote: > > On 2011-05-30 12:49, simendsjo wrote: > >> I'm having some problems trying to get the best of both worlds here. > >> > >> void f(Class c) { > >> > >>assert(c != null); > >>// use c > >> > >> } > >> > >> In this example

Re: nested comments

2011-05-30 Thread Jonathan M Davis
On 2011-05-30 14:21, Adam D. Ruppe wrote: > I use them when commenting out code or when writing documentation > examples. (which may have comments nested inside the doc comment) > > Commenting out code is the purpose in general though. Yeah, it's really annoying to comment out code with /* */ whe

Re: Compiling 64-bit code under Windows 7?

2011-05-30 Thread Jonathan M Davis
On 2011-05-30 14:17, Sean Eskapp wrote: > I'm trying to compile a very simple file, main.d: > > void main() > { > } > > Under Windows 7, 64-bit, with out-of-the-box DMD v2.053 installation. I get > this, however: > > C:\Users\Me\devl\test>dmd -m64 main.d > Internal error: msc.c 268 There is no

Re: Helping the compiler with assumptions while using exceptions

2011-05-30 Thread Timon Gehr
Jonathan M Davis wrote: > On 2011-05-30 12:49, simendsjo wrote: >> I'm having some problems trying to get the best of both worlds here. >> >> void f(Class c) { >>assert(c != null); >>// use c >> } >> >> In this example, we tell the compiler that c is never able to be null. >> The compiler c

Re: Compiling 64-bit code under Windows 7?

2011-05-30 Thread David Nadlinger
On 5/30/11 11:17 PM, Sean Eskapp wrote: I'm trying to compile a very simple file, main.d: void main() { } Under Windows 7, 64-bit, with out-of-the-box DMD v2.053 installation. I get this, however: C:\Users\Me\devl\test>dmd -m64 main.d Internal error: msc.c 268 x86_64 isn't supported on Windo

Re: nested comments

2011-05-30 Thread Adam D. Ruppe
I use them when commenting out code or when writing documentation examples. (which may have comments nested inside the doc comment) Commenting out code is the purpose in general though.

nested comments

2011-05-30 Thread %u
what is the purpose of nested comments ?

Compiling 64-bit code under Windows 7?

2011-05-30 Thread Sean Eskapp
I'm trying to compile a very simple file, main.d: void main() { } Under Windows 7, 64-bit, with out-of-the-box DMD v2.053 installation. I get this, however: C:\Users\Me\devl\test>dmd -m64 main.d Internal error: msc.c 268

Re: Helping the compiler with assumptions while using exceptions

2011-05-30 Thread Jonathan M Davis
On 2011-05-30 12:49, simendsjo wrote: > I'm having some problems trying to get the best of both worlds here. > > void f(Class c) { >assert(c != null); >// use c > } > > In this example, we tell the compiler that c is never able to be null. > The compiler can use assertions like this for o

Re: Helping the compiler with assumptions while using exceptions

2011-05-30 Thread bearophile
simendsjo: > void f(Class c) { >assert(c != null); >// use c > } > > In this example, we tell the compiler that c is never able to be null. > The compiler can use assertions like this for optimizations (not sure if > dmd does this though). I think currently DMD is not using this inform

Re: The compiler can not find the property function.

2011-05-30 Thread Jonathan M Davis
On 2011-05-30 08:54, choi heejo wrote: > Greeting. > > I tried to compile this code with DMD 2.053: > > @property bool isZero(float value) > { > return value < float.epsilon; > } > > void main() > { > 0.1f.isZero; > readln(); > } > > But the compiler said, > > no property 'isZero' for type 'f

Re: Template parameter defaults

2011-05-30 Thread Jonathan M Davis
On 2011-05-30 06:42, Johann MacDonagh wrote: > I'm wondering if there's a cleaner way to do this: > > class Test(T = uint) > { > this(string s) > { > } > } > > void main(string[] argv) > { > auto a = new Test!()("test"); > } > > I'd *like* to be able to do this: > > auto a =

Helping the compiler with assumptions while using exceptions

2011-05-30 Thread simendsjo
I'm having some problems trying to get the best of both worlds here. void f(Class c) { assert(c != null); // use c } In this example, we tell the compiler that c is never able to be null. The compiler can use assertions like this for optimizations (not sure if dmd does this though). But

Re: The compiler can not find the property function.

2011-05-30 Thread David Nadlinger
On 5/30/11 5:54 PM, choi heejo wrote: Greeting. I tried to compile this code with DMD 2.053: @property bool isZero(float value) { return value < float.epsilon; } void main() { 0.1f.isZero; readln(); } But the compiler said, no property 'isZero' for type 'float'. I cannot understand this err

The compiler can not find the property function.

2011-05-30 Thread choi heejo
Greeting. I tried to compile this code with DMD 2.053: @property bool isZero(float value) { return value < float.epsilon; } void main() { 0.1f.isZero; readln(); } But the compiler said, no property 'isZero' for type 'float'. I cannot understand this error.

Re: Linking with/Debugging static C/C++ libraries

2011-05-30 Thread Dmitry Olshansky
On 30.05.2011 19:14, Jeff Slutter wrote: On 5/30/2011 10:57 AM, Dmitry Olshansky wrote: It was me who brought it Unilink out of infernal abyss :) See also: http://www.digitalmars.com/d/archives/digitalmars/D/announce/Alternative_linker_win32_64_20086.html Seriously I still suggest to try it o

Re: Linking with/Debugging static C/C++ libraries

2011-05-30 Thread Jeff Slutter
On 5/30/2011 10:57 AM, Dmitry Olshansky wrote: > It was me who brought it Unilink out of infernal abyss :) See also: > http://www.digitalmars.com/d/archives/digitalmars/D/announce/Alternative_linker_win32_64_20086.html > > > Seriously I still suggest to try it out, and at any rate author showed

Re: Template parameter defaults

2011-05-30 Thread Johann MacDonagh
On 5/30/2011 10:12 AM, Jacob Carlborg wrote: If you want to use the default parameter I think you have to do this: auto a = new Test!()("test"); Yeah, that's the best I could come up with too :( I suppose users can alias it if necessary. Thanks!

Re: Linking with/Debugging static C/C++ libraries

2011-05-30 Thread Dmitry Olshansky
On 30.05.2011 16:57, Trass3r wrote: Am 30.05.2011, 04:09 Uhr, schrieb Jeff Slutter : One of the things that's important to us is being able to link against some existing C/C++ static libraries (built with VS 2008, so PE COFF format). Good luck with that. DLLs are no problem but static librarie

Re: Template parameter defaults

2011-05-30 Thread Jacob Carlborg
On 2011-05-30 15:42, Johann MacDonagh wrote: I'm wondering if there's a cleaner way to do this: class Test(T = uint) { this(string s) { } } void main(string[] argv) { auto a = new Test!()("test"); } I'd *like* to be able to do this: auto a = new Test("test"); and: auto a = new Test!double("

Template parameter defaults

2011-05-30 Thread Johann MacDonagh
I'm wondering if there's a cleaner way to do this: class Test(T = uint) { this(string s) { } } void main(string[] argv) { auto a = new Test!()("test"); } I'd *like* to be able to do this: auto a = new Test("test"); and: auto a = new Test!double("test"); The only possibility

Re: Linking with/Debugging static C/C++ libraries

2011-05-30 Thread Trass3r
Am 30.05.2011, 04:09 Uhr, schrieb Jeff Slutter : One of the things that's important to us is being able to link against some existing C/C++ static libraries (built with VS 2008, so PE COFF format). Good luck with that. DLLs are no problem but static libraries are another story. objconv has ne