www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - DMD 0.98 release

reply "Walter" <newshound digitalmars.com> writes:
Focussed on eliminating compiler hangs, gpf's and internal errors.

http://www.digitalmars.com/d/changelog.html
Aug 05 2004
next sibling parent reply "Ivan Senji" <ivan.senji public.srce.hr> writes:
Why don't scalar constructors take parametars?
int* ip = new int;
*ip == 0;

int* ip = new int(5);
*ip still == 0;

int* ip = new int(5,5,"HA");
*ip still == 0;

?

"Walter" <newshound digitalmars.com> wrote in message
news:cesu05$1bmc$1 digitaldaemon.com...
 Focussed on eliminating compiler hangs, gpf's and internal errors.

 http://www.digitalmars.com/d/changelog.html
Aug 05 2004
next sibling parent reply Matthias Becker <Matthias_member pathlink.com> writes:
Why don't scalar constructors take parametars?
int* ip = new int;
*ip == 0;

int* ip = new int(5);
*ip still == 0;

int* ip = new int(5,5,"HA");
*ip still == 0;
Well, structs don't have constructors. Scalar types seem not to have them, too.
Aug 05 2004
parent reply Daniel Horn <hellcatv hotmail.com> writes:
but you can overload OpCall for a struct and for a class to do the same 
thing
you cannot, however, overload OpCall for int unless I'm mistaken

so while you could make a common way to create either structs or classes 
, you have to specialize for all the basic types--and woe to you if you 
should encounter typedefs.

Matthias Becker wrote:
Why don't scalar constructors take parametars?
int* ip = new int;
*ip == 0;

int* ip = new int(5);
*ip still == 0;

int* ip = new int(5,5,"HA");
*ip still == 0;
Well, structs don't have constructors. Scalar types seem not to have them, too.
Aug 05 2004
parent pragma <EricAnderton at yahoo dot com> <pragma_member pathlink.com> writes:
In article <ceu40a$2355$1 digitaldaemon.com>, Daniel Horn says...
but you can overload OpCall for a struct and for a class to do the same 
thing
you cannot, however, overload OpCall for int unless I'm mistaken

so while you could make a common way to create either structs or classes 
, you have to specialize for all the basic types--and woe to you if you 
should encounter typedefs.
I, too was wondering why you can't simply go "new int(42)", when its pretty much the most obvious constructor a scalar type could have (IMO). Granted, it's pretty useless outside of templates, but it *looks* correct, right? Frustrating. Now if global operators were overload-able, I suppose this would be the equivalent of simulating a constructor on a built-in scalar type: Which doesn't get us very close: I wouldn't even begin to know how to roll a static 'new' operator for type int. Every time I try, the syntax folds up into something ambiguous. :( Now, not to beat a dead horse, but is this something that a "typedef block" (or "extended typedef" i guess) could help solve? At least then you have something that will /cast/ to an int with no trouble at all: Now what would really do the job is if we were allowed something like this in addition to the aforementioned sytnax: Any thoughts from the crowd? - Pragma
Aug 05 2004
prev sibling parent reply "Walter" <newshound digitalmars.com> writes:
"Ivan Senji" <ivan.senji public.srce.hr> wrote in message
news:cet2hu$1fbm$1 digitaldaemon.com...
 Why don't scalar constructors take parametars?
 int* ip = new int;
 *ip == 0;

 int* ip = new int(5);
 *ip still == 0;

 int* ip = new int(5,5,"HA");
 *ip still == 0;

 ?
I'm not sure what the case is for it. The reason for adding the current method is for Matthew's DTL.
Aug 05 2004
next sibling parent "Matthew" <admin.hat stlsoft.dot.org> writes:
"Walter" <newshound digitalmars.com> wrote in message
news:cettf5$1u0m$1 digitaldaemon.com...
 "Ivan Senji" <ivan.senji public.srce.hr> wrote in message
 news:cet2hu$1fbm$1 digitaldaemon.com...
 Why don't scalar constructors take parametars?
 int* ip = new int;
 *ip == 0;

 int* ip = new int(5);
 *ip still == 0;

 int* ip = new int(5,5,"HA");
 *ip still == 0;

 ?
I'm not sure what the case is for it. The reason for adding the current method is for Matthew's DTL.
That's great, but I agree with the others that one should be able to parameterise the construction. :) I also think structs should have ctors, but that's another issue. (Since we have faux-ctors by opCall, why not acecpt reality and give proper ctors?)
Aug 05 2004
prev sibling parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Walter wrote:

 "Ivan Senji" <ivan.senji public.srce.hr> wrote in message
 news:cet2hu$1fbm$1 digitaldaemon.com...
 
 Why don't scalar constructors take parametars?
 int* ip = new int;
 *ip == 0;
Would I be right to figure that this is just syntactic sugar for int* ip = new int[1]; albeit with some generic programming advantage I'm not sure I see?
 int* ip = new int(5);
 *ip still == 0;

 int* ip = new int(5,5,"HA");
 *ip still == 0;

 ?
I'm not sure what the case is for it. The reason for adding the current method is for Matthew's DTL.
Then what _does_ new int(5) mean at the moment? Or is it just a bug that the compiler accepts it? Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Aug 06 2004
parent "Walter" <newshound digitalmars.com> writes:
"Stewart Gordon" <smjg_1998 yahoo.com> wrote in message
news:cevvae$b09$1 digitaldaemon.com...
 Walter wrote:

 "Ivan Senji" <ivan.senji public.srce.hr> wrote in message
 news:cet2hu$1fbm$1 digitaldaemon.com...

 Why don't scalar constructors take parametars?
 int* ip = new int;
 *ip == 0;
Would I be right to figure that this is just syntactic sugar for int* ip = new int[1]; albeit with some generic programming advantage I'm not sure I see?
Yes.
 int* ip = new int(5);
 *ip still == 0;

 int* ip = new int(5,5,"HA");
 *ip still == 0;

 ?
I'm not sure what the case is for it. The reason for adding the current method is for Matthew's DTL.
Then what _does_ new int(5) mean at the moment? Or is it just a bug that the compiler accepts it?
At the moment, the compiler calls it an error <g>.
Aug 06 2004
prev sibling next sibling parent reply Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
Walter wrote:
 Focussed on eliminating compiler hangs, gpf's and internal errors.
 
 http://www.digitalmars.com/d/changelog.html
The changelog doesn't include 0.98. Otherwise, thanks much for the release!
Aug 05 2004
parent Lars Ivar Igesund <larsivar igesund.net> writes:
Russ Lewis wrote:

 Walter wrote:
 
 Focussed on eliminating compiler hangs, gpf's and internal errors.

 http://www.digitalmars.com/d/changelog.html
The changelog doesn't include 0.98. Otherwise, thanks much for the release!
Yes, it do (and it did). Maybe your browser had a problem that made it use the cache? Lars Ivar Igesund
Aug 05 2004
prev sibling parent Stewart Gordon <smjg_1998 yahoo.com> writes:
Walter wrote:

 Focussed on eliminating compiler hangs, gpf's and internal errors.
"Fixed Internal error: ..\ztc\cgcod.c 1464" There's more than one cause of this error. The one I posted still fails: http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.bugs/500 Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Aug 10 2004