digitalmars.D.learn - std.intrinsic and structs
- Jaheera (15/15) Nov 30 2007 I had some questions about the std.intrinsic functions:
 - Chad J (14/32) Nov 30 2007 I /think/ what you want is this:
 - Jaheera (4/34) Nov 30 2007 Actually you understood it perfectly, this appears to be exactly what i
 - Sean Kelly (8/13) Dec 03 2007 No. Though I suppose there's an outside chance we will get this feature...
 - Bill Baxter (4/22) Dec 03 2007 I think the thread is linked to from one of the Doc comments pages.
 - Sean Kelly (6/25) Dec 03 2007 You're right. I'm pretty sure it was this thread/comment. I could have...
 - Jaheera (3/28) Dec 06 2007 I see. Thanks for the clarification
 
I had some questions about the std.intrinsic functions:
Is it possible to do bt, bts and btr operations on ulongs as is already 
possible on uints?
Why do the intrinsic operations not return bool, instead of 0 and -1?
I also have a question about structs.
I want to do this, but this obviously doesn't work:
struct foo(int var)
{
    int[var] x;
}
struct bar
{
    foo[4] zeb(10);
}
Thanks. 
 Nov 30 2007
Jaheera wrote:
 
 I also have a question about structs.
 
 I want to do this, but this obviously doesn't work:
 
 struct foo(int var)
 {
     int[var] x;
 }
 
 struct bar
 {
     foo[4] zeb(10);
 }
 
 Thanks. 
 
 
I /think/ what you want is this:
struct foo(int var)
{
   int[var] x; // static array of 'var' elements
}
struct bar
{
   /* static array of 4 elements containing foos that contain static 
arrays of 10 elements. */
   foo!(10)[4] zeb;
}
I'm sorry I don't know if I'm actually helping.  I don't entirely 
understand the question.
 Nov 30 2007
"Chad J" <gamerChad _spamIsBad_gmail.com> wrote in message news:fipmho$ivc$1 digitalmars.com...Jaheera wrote:Actually you understood it perfectly, this appears to be exactly what i needed, thanks!I also have a question about structs. I want to do this, but this obviously doesn't work: struct foo(int var) { int[var] x; } struct bar { foo[4] zeb(10); } Thanks.I /think/ what you want is this: struct foo(int var) { int[var] x; // static array of 'var' elements } struct bar { /* static array of 4 elements containing foos that contain static arrays of 10 elements. */ foo!(10)[4] zeb; } I'm sorry I don't know if I'm actually helping. I don't entirely understand the question.
 Nov 30 2007
Jaheera wrote:I had some questions about the std.intrinsic functions: Is it possible to do bt, bts and btr operations on ulongs as is already possible on uints?No. Though I suppose there's an outside chance we will get this feature once DMD can compile 64-bit code.Why do the intrinsic operations not return bool, instead of 0 and -1?Walter has historically had an aversion to bool return values (opEquals, for example) because he felt that they were inefficient. I believe someone once demonstrated that this isn't actually true, but I'll be darned if I can find the thread. Sean
 Dec 03 2007
Sean Kelly wrote:Jaheera wrote:I think the thread is linked to from one of the Doc comments pages. Probably the one for wherever opEquals and opCmp are described. --bbI had some questions about the std.intrinsic functions: Is it possible to do bt, bts and btr operations on ulongs as is already possible on uints?No. Though I suppose there's an outside chance we will get this feature once DMD can compile 64-bit code.Why do the intrinsic operations not return bool, instead of 0 and -1?Walter has historically had an aversion to bool return values (opEquals, for example) because he felt that they were inefficient. I believe someone once demonstrated that this isn't actually true, but I'll be darned if I can find the thread. Sean
 Dec 03 2007
Bill Baxter wrote:Sean Kelly wrote:You're right. I'm pretty sure it was this thread/comment. I could have sworn that Walter had replied to the one I was thinking of, but I must be misremembering: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.bugs&article_id=8005 SeanJaheera wrote:I think the thread is linked to from one of the Doc comments pages. Probably the one for wherever opEquals and opCmp are described.I had some questions about the std.intrinsic functions: Is it possible to do bt, bts and btr operations on ulongs as is already possible on uints?No. Though I suppose there's an outside chance we will get this feature once DMD can compile 64-bit code.Why do the intrinsic operations not return bool, instead of 0 and -1?Walter has historically had an aversion to bool return values (opEquals, for example) because he felt that they were inefficient. I believe someone once demonstrated that this isn't actually true, but I'll be darned if I can find the thread.
 Dec 03 2007
"Sean Kelly" <sean f4.ca> wrote in message news:fj201d$261a$1 digitalmars.com...Bill Baxter wrote:I see. Thanks for the clarificationSean Kelly wrote:You're right. I'm pretty sure it was this thread/comment. I could have sworn that Walter had replied to the one I was thinking of, but I must be misremembering: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.bugs&article_id=8005 SeanJaheera wrote:I think the thread is linked to from one of the Doc comments pages. Probably the one for wherever opEquals and opCmp are described.I had some questions about the std.intrinsic functions: Is it possible to do bt, bts and btr operations on ulongs as is already possible on uints?No. Though I suppose there's an outside chance we will get this feature once DMD can compile 64-bit code.Why do the intrinsic operations not return bool, instead of 0 and -1?Walter has historically had an aversion to bool return values (opEquals, for example) because he felt that they were inefficient. I believe someone once demonstrated that this isn't actually true, but I'll be darned if I can find the thread.
 Dec 06 2007








 
 
 
 "Jaheera" <no spam.com> 