[D1] capitalize cannot be interpreted at CT

2010-07-21 Thread strtr
Could somebody please explain this error to me. import std.uni : toUniUpper; import std.string : capitalize; void main() { const char[] name = `test`; // C:\dmd\src\phobos\std\string.d(983): Error: _aApplycd2 cannot be interpreted at compile time, because it has no

Re: [D1] capitalize cannot be interpreted at CT

2010-07-21 Thread strtr
== Quote from Ellery Newcomer (ellery-newco...@utulsa.edu)'s article On 07/21/2010 09:09 PM, strtr wrote: Could somebody please explain this error to me. evidently ctfe can't eat foreach(i, dchar d; s){ } Bleach. Make sure it's in bugzilla. Thanks, found it: http://d.puremagic.com/issues

Re: pu$�le

2010-07-18 Thread strtr
== Quote from Jonathan M Davis (jmdavisp...@gmail.com)'s article On Saturday 17 July 2010 22:10:07 strtr wrote: == Quote from Jonathan M Davis (jmdavisp...@gmail.com)'s article On Saturday 17 July 2010 18:59:18 strtr wrote: That is [dollar sign, euro sign] The reason I post

Re: pu$�le

2010-07-18 Thread strtr
== Quote from Jonathan M Davis (jmdavisp...@gmail.com)'s article On Sunday 18 July 2010 04:13:03 bearophile wrote: Jonathan M Davis: You should pretty much never deal with each individual char or wchar in a string or wstring. Do the conversion to dchar or dstring if you want to access

Re: pu$�le

2010-07-18 Thread strtr
== Quote from Jonathan M Davis (jmdavisp...@gmail.com)'s article On Sunday 18 July 2010 00:46:36 Jonathan M Davis wrote: I'll file a bug report - Jonathan M Davis Wait. That's not the problem. Or at least, that's not the problem that needs to be reported. The problem is that we're not

Re: pu$�le

2010-07-18 Thread strtr
== Quote from Jonathan M Davis (jmdavisp...@gmail.com)'s article On Saturday 17 July 2010 23:01:28 strtr wrote: Cheated? I thought that you were trying to figure out why the code wasn't d oing what you expected it to be doing. So, of course I ran it. Though, it's more likely that I

Re: pu$�le

2010-07-18 Thread strtr
== Quote from Jonathan M Davis (jmdavisp...@gmail.com)'s article On Sunday 18 July 2010 10:59:21 strtr wrote: I totally agree that putting a cast there is probably not really a solution (or legal). Warnings for all non-dchar types. Is there anybody using foreach(c;chars) || foreach(char c

Re: pu$�le

2010-07-18 Thread strtr
== Quote from Jonathan M Davis (jmdavisp...@gmail.com)'s article On Sunday 18 July 2010 00:46:36 Jonathan M Davis wrote: I'll file a bug report - Jonathan M Davis Wait. That's not the problem. Or at least, that's not the problem that needs to be reported. The problem is that we're not

Re: pu$�le

2010-07-18 Thread strtr
== Quote from Jonathan M Davis (jmdavisp...@gmail.com)'s article On Sunday 18 July 2010 17:36:58 strtr wrote: I don't agree with this bug report because of two reasons. 1. Warnings are supposed to be warnings, not errors. If you want to see those warnings you'll use -w. What you

Re: pu$�le

2010-07-18 Thread strtr
== Quote from Jonathan M Davis (jmdavisp...@gmail.com)'s article On Sunday 18 July 2010 19:14:11 strtr wrote: I'm not sure whether you missed my point or are simple thinking out loud about unreachable code being a warning. My point was that the unreachable warning was wrong

pu$�le

2010-07-17 Thread strtr
What does this program print? const char[] coins = `$�`; void main() { writef(`I made `); int stash = 0; scope(exit) writefln(stash,`.`); scope(failure) stash--; foreach(coin;coins) { scope(exit) stash++;

Re: pu$�le

2010-07-17 Thread strtr
That is [dollar sign, euro sign] The reason I post it is because I expected the stash to be 3 lower.

Re: pu$�le

2010-07-17 Thread strtr
== Quote from Jonathan M Davis (jmdavisp...@gmail.com)'s article On Saturday 17 July 2010 18:59:18 strtr wrote: That is [dollar sign, euro sign] The reason I post it is because I expected the stash to be 3 lower. As to why it's not working right, change th foreach loop to this: foreach

Re: pu$�le

2010-07-17 Thread strtr
== Quote from Jonathan M Davis (jmdavisp...@gmail.com)'s article On Saturday 17 July 2010 18:59:18 strtr wrote: That is [dollar sign, euro sign] The reason I post it is because I expected the stash to be 3 lower. Well, if I replace writef with write, I get I made $€8. If I leave

Re: pu$�le

2010-07-17 Thread strtr
== Quote from Jonathan M Davis (jmdavisp...@gmail.com)'s article On Saturday 17 July 2010 21:48:30 strtr wrote: == Quote from Jonathan M Davis (jmdavisp...@gmail.com)'s article On Saturday 17 July 2010 18:59:18 strtr wrote: That is [dollar sign, euro sign] The reason I post

Re: CT usage only in executable

2010-07-15 Thread strtr
== Quote from strtr (st...@sp.am)'s article == Quote from bearophile (bearophileh...@lycos.com)'s article strtr: Not that the memory is really significant compared to the rest of my program, but I have a few fairly large arrays I use only in compile time and I was wondering why dmd

CT usage only in executable

2010-07-14 Thread strtr
Not that the memory is really significant compared to the rest of my program, but I have a few fairly large arrays I use only in compile time and I was wondering why dmd still includes those in the executable (simple text search dug them up).

Re: CT usage only in executable

2010-07-14 Thread strtr
== Quote from bearophile (bearophileh...@lycos.com)'s article strtr: Not that the memory is really significant compared to the rest of my program, but I have a few fairly large arrays I use only in compile time and I was wondering why dmd still includes those in the executable (simple

Class knowing its own Class

2010-06-29 Thread strtr
What is the pretty way to do something like this? Class C { private const char[] _name = C;// demangling this.mangleof didn't work void makeNew() { mixin(`new `~_name~`();`); // the not so pretty part } }

Re: Class knowing its own Class

2010-06-29 Thread strtr
== Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article On Tue, 29 Jun 2010 17:59:37 -0400, strtr st...@sp.am wrote: What is the pretty way to do something like this? Class C { void makeNew() { new typeof(this); } } As edited... -Steve Whahaha! Thanks, I

Re: Object removing own last reference.

2010-06-25 Thread strtr
== Quote from Simen kjaeraas (simen.kja...@gmail.com)'s article strtr st...@sp.am wrote: void externalFunc(){} class C { .. int index_; int yay; void removeMe() { //remove last reference to this object objects[_index] = null; //other critical code

Object removing own last reference.

2010-06-24 Thread strtr
void externalFunc(){} class C { .. int index_; int yay; void removeMe() { //remove last reference to this object objects[_index] = null; //other critical code memberFunc(); externalFunc(); } void memberFunc(){yay++} } Is there anything unsafe about his code?

Re: Documentation suggestion

2010-06-15 Thread strtr
== Quote from bearophile (bearophileh...@lycos.com)'s article Larry Luther: For those writing documentation, I would recommend: http://docs.eiffel.com/book/method/et-dynamic-structure-execution-model If I had had something like that for D it would have saved me a lot of guessing and

Re: enum overloading

2010-05-23 Thread strtr
== Quote from Ellery Newcomer (ellery-newco...@utulsa.edu)'s article On 05/22/2010 08:20 PM, Ellery Newcomer wrote: From a discussion with walter a while back, I gathered not possible. Strike this line, not sure what I was thinking of here Saves me a bit of parsing allocation ;)

Re: enum overloading

2010-05-23 Thread strtr
== Quote from Ellery Newcomer (ellery-newco...@utulsa.edu)'s article On 05/23/2010 07:35 AM, strtr wrote: Did I miss it or should I add a bug report? http://www.digitalmars.com/d/2.0/hijack.html That's not really the D1 spec.. a bug report it is :D (it strikes me that this is a necessary

Re: enum overloading

2010-05-22 Thread strtr
Sorry, should have included this :) module main; import std.string; import std.stdio; enum ENUM { A,B } char[] toString(ENUM e_){return enum;} void main (){ writefln( toString(3) ); writefln( toString(ENUM.A) ); } -- main.d(10): Error: function main.toString (ENUM) does

Re: enum overloading

2010-05-22 Thread strtr
== Quote from Ary Borenszweig (a...@esperanto.org.ar)'s article Ary Borenszweig wrote: strtr wrote: Sorry, should have included this :) module main; import std.string; import std.stdio; enum ENUM { A,B } char[] toString(ENUM e_){return enum;} void main

Re: template mixin in class is virtual function?

2010-05-21 Thread strtr
== Quote from div0 (d...@users.sourceforge.net)'s article -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 strtr wrote: Or more to the point: Can (Class) template mixin functions be devirtualized by the compiler or do I (as optimization) need to manually copy paste the boiler plate code

Re: template mixin in class is virtual function?

2010-05-21 Thread strtr
== Quote from div0 (d...@users.sourceforge.net)'s article strtr wrote: Is that different from making all functions within the template final? Well it delegates the choice of virtual versus non virtual to the class using the mixin. No idea if that's a good idea or a bad one; I guess you'd

template mixin in class is virtual function?

2010-05-19 Thread strtr
Will template-mixin-functions always be virtual in classes? Mixins can add virtual functions to a class http://www.digitalmars.com/d/1.0/template-mixin.html related: http://odefu.blogspot.com/2008/12/composite-oriented-programming.html

Re: Three legitimate bugs? (D1.061)

2010-05-17 Thread strtr
== Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article On Sat, 15 May 2010 16:15:23 -0400, strtr st...@spam.com wrote: Should I report these bugs? (and how should I call this first one?) module main; //const S S1 = S(); // uncomment this to compile struct S

Three legitimate bugs? (D1.061)

2010-05-15 Thread strtr
Should I report these bugs? (and how should I call this first one?) module main; //const S S1 = S(); // uncomment this to compile struct S { float value; static S opCall() { S s; return s; } const S S2 = S(); } void main(){} -- main.d(4): Error: struct main.S no size yet for

Re: Loop optimization

2010-05-15 Thread strtr
== Quote from Don (nos...@nospam.com)'s article strtr wrote: == Quote from bearophile (bearophileh...@lycos.com)'s article But the bigger problem in your code is that you are performing operations on NaNs (that's the default initalization of FP values in D), and operations on NaNs

Re: Three legitimate bugs? (D1.061)

2010-05-15 Thread strtr
== Quote from bearophile (bearophileh...@lycos.com)'s article strtr Wrote: Should I report these bugs? Yes, add them to bugzilla. The third one is especially cute. Was kind of expecting you to correct me or point me to the corresponding bugzillas ;D (and how should I call this first one

Re: Assertion failure: 'fieldi=0 fieldi se-elements-dim' on line 2062 in file 'interpret.c'

2010-05-14 Thread strtr
or : module main; //const S s = S(.5f); // Uncomment to make it compile struct S { float a; static S opCall( float a_ ) { S s = { a_ }; return s; } const S _s = S( 1f ); } void main(){}

Re: Loop optimization

2010-05-14 Thread strtr
== Quote from bearophile (bearophileh...@lycos.com)'s article But the bigger problem in your code is that you are performing operations on NaNs (that's the default initalization of FP values in D), and operations on NaNs are usually quite slower. I didn't know that. Is it the same for inf? I

Re: Assertion failure: 'fieldi=0 fieldi se-elements-dim' on line 2062 in file 'interpret.c'

2010-05-13 Thread strtr
Don Wrote: strtr wrote: Killed it again :( Are you using the latest DMD? I was/am using 1.060 If so, please try to create a test case, as this bug has never been reported before. Thanks! Had to put some time into actual coding.. but I just tried to create a test case: Removed the few

Re: Assertion failure: 'fieldi=0 fieldi se-elements-dim' on line 2062 in file 'interpret.c'

2010-05-07 Thread strtr
Not feeding a float to ToString! seems to bring it back to life. What is up with that anyway? How do I output a float in compile time?

.ptr and .value

2010-05-05 Thread strtr
I keep on expecting .ptr to work on all types. What keeps this from being the case? And how about having a .value(.deref) property for known pointers? I feel a lot less comfortable with using stars and ampersands, because I keep on forgetting which one does what.

Re: .ptr and .value

2010-05-05 Thread strtr
Robert Clipsham Wrote: On 05/05/10 23:20, strtr wrote: I keep on expecting .ptr to work on all types. What keeps this from being the case? And how about having a .value(.deref) property for known pointers? I feel a lot less comfortable with using stars and ampersands, because I

Re: tools.ctfe for D1

2010-04-21 Thread strtr
FeepingCreature Wrote: On 20.04.2010 01:49, Ellery Newcomer wrote: Are there any good libraries for ctfe/code generation? I don't know, things like parsing support for compile time strings, string formatting, type - string My project seems to be growing ctfe, and it's all horribly

operator precedence

2010-04-10 Thread strtr
Are D's operator precedence rules the same as C's? http://www.difranco.net/cop2220/op-prec.htm Couldn't find such a table on the D website.

writefln on interface array

2010-04-07 Thread strtr
Is it possible to have this output [null,1] in stead of Error: std.format formatArg? interface I{} class C:I{ int index; char[] toString(){ return toString(index) } } I[2] two_i; I[1] = new C(); writefln(two_i); Would be handy for debugging ;)

Re: Confused about class equality

2010-04-06 Thread strtr
Justin Spahr-Summers Wrote: Hmm, that is pretty weird. Are you doing any casts anywhere, or any pointer arithmetic/tricks? A search for cast didn't show any related casts. Do you maybe know another thing to check? I do throw references around and there are a lot of implicit casts to extended

Re: Confused about class equality

2010-04-04 Thread strtr
Ali Çehreli Wrote: The code works as expected with 2.042 I had to modify the toString() functions to return string, and say override in C's toString definition; and had to modify the writefln() calls: writefln(%s : %s %s, i2.toString(), i2.__vptr, i2.__monitor); The output:

Re: Confused about class equality

2010-04-03 Thread strtr
Jacob Carlborg Wrote: On 4/3/10 07:03, strtr wrote: What I probably mean to ask is : In the code below, for what kind of i1 and i2 would the output be like this : - Same Value. 3 : 5B536C 59D020 3 : 59CE0C 59CEF0 5 : 5B536C 59D020 5 : 59CE0C 59CEF0 - if( i1

Confused about class equality

2010-04-02 Thread strtr
The program below outputs, as I would expect : Same Value. Same Object. 3 : 44E15C 3 : 44E15C 5 : 44E15C 5 : 44E15C Now what would it mean if it were to output : Same Value. 3 : 5B536C 59D020 3 : 59CE0C 59CEF0 5 : 5B536C 59D020 5 : 59CE0C 59CEF0 (Output from essentially the

Re: Confused about class equality

2010-04-02 Thread strtr
Justin Spahr-Summers Wrote: On Fri, 02 Apr 2010 22:36:40 -0400, strtr st...@spam.com wrote: You may want to try reducing the code within your larger project to the smallest use case where the problem still occurs, because, I agree, the code as written will always result in the same object

Re: Confused about class equality

2010-04-02 Thread strtr
What I probably mean to ask is : In the code below, for what kind of i1 and i2 would the output be like this : - Same Value. 3 : 5B536C 59D020 3 : 59CE0C 59CEF0 5 : 5B536C 59D020 5 : 59CE0C 59CEF0 - if( i1 !is null i2 !is null i2.value == i1.value ) { writefln(Same

Re: dup and arrays

2010-03-26 Thread strtr
Ellery Newcomer Wrote: I just noticed that dup does not dup deep. In a two second search I couldn't find any reason for or against, but I'd kinda like it if auto r2 = r.dup; r2[i][j] = 0; r[i][j] = 1; assert(r2[i][j] != r[i][j]); held. There have been discussions about this

void initialization vs alignment holes

2010-03-06 Thread strtr
This is probably going a bit above my head, but the existence of alignment holes in the objects is accounted for, usually by setting them all to 0 upon initialization I suspect this isn't the case for void initialization; if my struct has some alignment hole I better not void initialize it if

Re: void initialization vs alignment holes

2010-03-06 Thread strtr
BCS Wrote: Hello Strtr, Would you ever have an alignment hole if all the struct contains are basic types(excluding bool)? real, char[n], byte[n] and short[m] (for n%4 != 0 and m%2 != 0) might be an issue. Sounds logical, thanks!

Re: void initialization vs alignment holes

2010-03-06 Thread strtr
bearophile Wrote: strtr: I suspect this isn't the case for void initialization; if my struct has some alignment hole I better not void initialize it if ever I want to compare it with something. Is this correct? That has to be correct. Might this be worth an explicit mention

Re: compile time opCall array assignment

2010-02-26 Thread strtr
Don Wrote: Because expressions of the form a.b[i]= c aren't yet supported in CTFE. It will work in a couple of compiler releases from now. Only D2, or D1 as well? Workaround: int[2] x; x[0]=i1_; x[1]=i2_; res.arr=x; :)

compile time opCall array assignment

2010-02-25 Thread strtr
struct S{ int[2] arr = 0; static S opCall( int i1_, int i2_) { S res = void; res.arr[0] = i1_; res.arr[1] = i2_; return res; } } const S CS= S(0,0); Why can't this be evaluated at compile time? (And how do I

Re: immutable string literal?

2010-02-22 Thread strtr
Daniel Keep Wrote: strtr wrote: On winXP (D1) I can compile/run this code without a problem. Not even a warning. void main() { char[] s= immutable literal?; s[$-1] = '!'; writefln(s); } Codepad runs into a segmentation fault. http://codepad.org/NQfsRoR5 Why

Re: immutable string literal?

2010-02-22 Thread strtr
Steven Schveighoffer Wrote: On Mon, 22 Feb 2010 08:32:20 -0500, strtr st...@spam.com wrote: Daniel Keep Wrote: strtr wrote: On winXP (D1) I can compile/run this code without a problem. Not even a warning. void main() { char[] s= immutable literal?; s[$-1

Re: immutable string literal?

2010-02-22 Thread strtr
grauzone Wrote: Windows can protect memory as read-only too. Why dmd doesn't do that is a mystery. Even if .exe doesn't support read-only data segments, the runtime could have done so in early start-up code. If that is the case, then I'd suggest a(n enhancement?) bug-report :)

Re: immutable string literal?

2010-02-22 Thread strtr
Steven Schveighoffer Wrote: But still, what does it matter? Just don't use D1 if you want a compiler error, or don't try and trick the system into modifying ROM! There are plenty of projects using D1 that just don't do this, and they are fine. Implementing features to help people

immutable string literal?

2010-02-21 Thread strtr
On winXP (D1) I can compile/run this code without a problem. Not even a warning. void main() { char[] s= immutable literal?; s[$-1] = '!'; writefln(s); } Codepad runs into a segmentation fault. http://codepad.org/NQfsRoR5 Why doesn't it result in a compiler error or warning? If it did I

How DMD's -w *Prevents* Me From Seeing My Warnings

2010-02-13 Thread strtr
or: Why does dmd keep on crashing on my code :) (I blame it on the average D programming; they don't write enough crappy code ) After reading the -w post I tried using the -w switch again and it also prevents me from seeing all my warning, but for a different reason : it crashes dmd :( Before

Re: How DMD's -w *Prevents* Me From Seeing My Warnings

2010-02-13 Thread strtr
daoryn Wrote: size_t is the default type to use as index on arrays, since the length property of arrays is of size_t. Since you are overloading the Index operator, its only logical the type of the index to be size_t. Ah, luckily this code is not really used as it should be an opcall :)

Re: interpret.c assertion failure on enum.stringof mixin

2010-02-07 Thread strtr
strtr Wrote: strtr Wrote: enum { E }; void _mixin() { writefln( E.stringof ); } void func() { mixin(_mixin); } Assertion failure: '!dim || (parameters (parameters-dim == dim))' on line 140 in file 'interpret.c' At least I got a line number this time :) Had

composing a class with template mixins

2010-02-06 Thread strtr
Recently I started moving all functionality within my larger classes to (10+) templates. abstract class AC : I { mixin abstractConstructors!(); mixin abstractNamedInterfaceFunctionallity_1!(); //e.g. abstractEvents!() mixin abstractNamedInterfaceFunctionallity_2!(); .. mixin

interpret.c assertion failure on enum.stringof mixin

2010-02-06 Thread strtr
enum { E }; void _mixin() { writefln( E.stringof ); } void func() { mixin(_mixin); } Assertion failure: '!dim || (parameters (parameters-dim == dim))' on line 140 in file 'interpret.c' At least I got a line number this time :)

Re: dmd crash help

2010-02-04 Thread strtr
Don Wrote: Excellent! I can reproduce it. The D2 version of this code (char[] text = `Hi`.dup;) segfaults in Expression::arraySyntaxCopy() in expression.c, with evidence of memory corruption. The D1 version does *not* segfault there. In fact the code compiles with the debug version of

Re: dmd crash help

2010-02-04 Thread strtr
Trass3r Wrote: Building is straightforward. Just run make -f*youros*.mak. Should I be offended ? Works flawlessly out of the box for me with dmc on windows. Took me only a few minutes, thanks. But I had to install a compiler to a different language ;)

Re: dmd crash help

2010-02-03 Thread strtr
strtr Wrote: dmd(1.048/55/56) crashed on me: AppName: dmd.exe AppVer: 0.0.0.0 ModName: unknown ModVer: 0.0.0.0Offset: 0002 There is a lot of crash data but I do not know where to start looking. I've also tried finding which part of the code is responsible, but I

Re: dmd crash help

2010-02-02 Thread strtr
Don Wrote: strtr wrote: dmd(1.048/55/56) crashed on me: AppName: dmd.exe AppVer: 0.0.0.0 ModName: unknown ModVer: 0.0.0.0 Offset: 0002 There is a lot of crash data but I do not know where to start looking. I've also tried finding which part of the code

Re: dmd crash help

2010-02-02 Thread strtr
BCS Wrote: Hello Strtr, If you can try it on linux it's not to hard to build a debug version of dmd and run it under the debugger. That will at least give you a filename/line number for the bug report and with a little thinking and a stack trace you can take a guess at what code

Re: dmd crash help

2010-02-02 Thread strtr
strtr Wrote: dmd(1.048/55/56) crashed on me: I've also tried finding which part of the code is responsible, but I haven't found it yet. I keep forgetting my best method yet : compiling module by module until something strange comes up, or in this case, the compiler chokes. Seems

Re: default opAssign(string) behaviour

2010-01-28 Thread strtr
Thanks, now it looks obviously messy to me as well :)

default opAssign(string) behaviour

2010-01-27 Thread strtr
Personally, I use (D1)std2.conv a lot to get values from strings and thus would love the following default behaviour for all types: int i = 0; // i = 0 i = cast( int ) 0; // i = 48 ( If I read the utf8 table correctly ) What keeps this from being the case?

Re: boolean over multiple variables

2010-01-25 Thread strtr
Simen kjaeraas Wrote: On Mon, 25 Jan 2010 09:59:42 +0100, Pelle MÃ¥nsson pelle.mans...@gmail.com wrote: On 01/23/2010 12:29 AM, strtr wrote: Simen kjaeraas Wrote: Not tested, but they should work: if ( anySame( var, a, b, c, d ) ) { } if ( allSame( var, a, b, c, d

Re: incomprehensible return error bug?

2010-01-25 Thread strtr
g Wrote: g Wrote: strtr Wrote: strtr Wrote: This error also points to the enum which is probably incorrectly used somewhere s_def(32) Error: cannot implicitly convert expression (5) of type int to S Still searching for the original bug btw :( Found

Re: Timer library?

2010-01-25 Thread strtr
Stanislav Blinov Wrote: Pelle Månsson wrote: I'm in need for a timer library that measures the acutal time. I have tried std.c.time's clock(), but it only measures time spent inside the program, not actual time elapsed. I need at least millisecond resolution, so std.c.time.time() is

Re: incomprehensible return error bug?

2010-01-24 Thread strtr
strtr Wrote: enum { A = 0, B, C } void func(){ return A; } void main() { } main.d(1): Error: long has no effect in expression (0) Is this a bug? This error also points to the enum which is probably incorrectly used somewhere s_def(32) Error: cannot implicitly convert expression (5

Re: incomprehensible return error bug?

2010-01-24 Thread strtr
strtr Wrote: This error also points to the enum which is probably incorrectly used somewhere s_def(32) Error: cannot implicitly convert expression (5) of type int to S Still searching for the original bug btw :( Found it, also a return type mismatch problem; returning a enum member where

boolean over multiple variables

2010-01-22 Thread strtr
This may be is a very basic question, but is there a way to let me omit a repeating variable when doing multiple boolean operations? if ( var == a || var == b || var == c || var == d) if ( var == (a || b || c || d) )

Re: boolean over multiple variables

2010-01-22 Thread strtr
Simen kjaeraas Wrote: Not tested, but they should work: if ( anySame( var, a, b, c, d ) ) { } if ( allSame( var, a, b, c, d ) ) { } A lot prettier. I thought there would be a generic (basic) solution to this which I just didn't know about but maybe I actually do know the basics by

Re: Dtnamic array memory allocation

2010-01-07 Thread Strtr
Rob Adelberg Wrote: Does the dynamic array pre-allocate any memory? I'm curious if the ~= on an array would be time sensitive. Would it make sense to allocate memory myself and then reset the length? class A { uint [] array; : this() { array = new uint [10]; or,