digitalmars.D - Structure property bug?
- Todd (38/38) Oct 04 2007 I'm using DFL w/DMD ver 1.020 and receive the following compile
- Steven Schveighoffer (9/45) Oct 04 2007 This works. I think you have a few syntax errors:
- Steven Schveighoffer (10/11) Oct 04 2007 I just realized also that assuming D has the same operator precedence as...
- Regan Heath (6/8) Oct 04 2007 It's not ideal but you can figure out precedence by looking at:
- Steven Schveighoffer (6/13) Oct 04 2007 I think you are right about this, but it is VERY subtle. I had to read ...
- Regan Heath (4/20) Oct 04 2007 http://www.digitalmars.com/d/archives/12484.html
- Steven Schveighoffer (11/13) Oct 04 2007 Hm... I guess we know Walter's opinion :) If it's just a question of no...
- Regan Heath (7/22) Oct 04 2007 I think that's a good idea, the most likely to see results any time
- James Dennett (6/30) Oct 04 2007 Operator precendence for C++ cannot be (correctly) expressed
- Janice Caron (3/5) Oct 05 2007 Ooh, now that's an interesting statement!
- Todd (4/24) Oct 04 2007 Thanks Steve
I'm using DFL w/DMD ver 1.020 and receive the following compile error's: no property 'Data' for type 'ARINCDATA_CELL [51u]' ArincWord is not an lvalue ReceivedChannel is not an lvalue Returned status code 1 Code: alias uint ArincWord; alias uint TimeRead; alias short ReceivedChannel; struct ARINCDATA_CELL { align(1): short Channel; uint Time; uint Data; } . . . ARINCDATA_CELL ArincData[51]; . . if(ArincData.Data &0xff == 203) { ArincWord = ArincData[i].Data; ReceivedChannel = ArincData[i].Channel; } . . . Tried everything I could think of but no dice. Think its related to the "[51]" or a bug. I've seen this error posted in the past, however none of the solutions seem to work, unless I missed one somewhere? Any idea's? Todd
Oct 04 2007
"Todd" wroteI'm using DFL w/DMD ver 1.020 and receive the following compile error's: no property 'Data' for type 'ARINCDATA_CELL [51u]' ArincWord is not an lvalue ReceivedChannel is not an lvalue Returned status code 1 Code: alias uint ArincWord; alias uint TimeRead; alias short ReceivedChannel; struct ARINCDATA_CELL { align(1): short Channel; uint Time; uint Data; } . . . ARINCDATA_CELL ArincData[51]; . . if(ArincData.Data &0xff == 203) { ArincWord = ArincData[i].Data; ReceivedChannel = ArincData[i].Channel; } . . . Tried everything I could think of but no dice. Think its related to the "[51]" or a bug. I've seen this error posted in the past, however none of the solutions seem to work, unless I missed one somewhere? Any idea's?This works. I think you have a few syntax errors: if(ArincData[i].Data &0xff == 203) { ArincWord v1 = ArincData[i].Data; ReceivedChannel v2= ArincData[i].Channel; } Note the [i] in the if statement, and the variable names v1 and v2. -Steve
Oct 04 2007
"Steven Schveighoffer" wroteif(ArincData[i].Data &0xff == 203)I just realized also that assuming D has the same operator precedence as C/C++, this really evalulates as: if(ArincData[i].Data & (0xff == 203)) Which will obviously be compiled out. So what you really want is: if((ArincData[i].Data & 0xff) == 203) BTW, I looked through the entire spec, and cannot find operator precedence anywhere. Anyone know where it is? -Steve
Oct 04 2007
Steven Schveighoffer wrote:BTW, I looked through the entire spec, and cannot find operator precedence anywhere. Anyone know where it is?It's not ideal but you can figure out precedence by looking at: http://www.digitalmars.com/d/expression.html The first operator mentioned is , and it has the lowest precedence (due to how the syntax tree is parsed - I think). regan
Oct 04 2007
"Regan Heath" wroteSteven Schveighoffer wrote:I think you are right about this, but it is VERY subtle. I had to read it for about 20 minutes before I understood what you are talking about. It would be nice to have a table at the end, which summarizes the precedence. Walter? -SteveBTW, I looked through the entire spec, and cannot find operator precedence anywhere. Anyone know where it is?It's not ideal but you can figure out precedence by looking at: http://www.digitalmars.com/d/expression.html The first operator mentioned is , and it has the lowest precedence (due to how the syntax tree is parsed - I think).
Oct 04 2007
Steven Schveighoffer wrote:"Regan Heath" wrotehttp://www.digitalmars.com/d/archives/12484.html <g> ReganSteven Schveighoffer wrote:I think you are right about this, but it is VERY subtle. I had to read it for about 20 minutes before I understood what you are talking about. It would be nice to have a table at the end, which summarizes the precedence. Walter?BTW, I looked through the entire spec, and cannot find operator precedence anywhere. Anyone know where it is?It's not ideal but you can figure out precedence by looking at: http://www.digitalmars.com/d/expression.html The first operator mentioned is , and it has the lowest precedence (due to how the syntax tree is parsed - I think).
Oct 04 2007
"Regan Heath" wrotehttp://www.digitalmars.com/d/archives/12484.html <g>Hm... I guess we know Walter's opinion :) If it's just a question of not having time to do the table, would it be possible for someone to write one and submit it for Walter to include? Because telling someone to manually parse the grammar to me is like telling someone to go read the compiler code to figure out the precedence. I know a lot of good coders who don't necessarily read language grammar specs. Even I, who understood generally what the grammar spec means, didn't get that the operator precedence was "hidden" in the grammar. I generally ignore the grammar boxes and just read the english descriptions/examples. -Steve
Oct 04 2007
Steven Schveighoffer wrote:"Regan Heath" wroteI think that's a good idea, the most likely to see results any time soon. I suspect operator precedence in D is almost identical to C/C++ so I'd start by copying a table for C/C++, eg. (a quick google) http://www.difranco.net/cop2220/op-prec.htm Reganhttp://www.digitalmars.com/d/archives/12484.html <g>Hm... I guess we know Walter's opinion :) If it's just a question of not having time to do the table, would it be possible for someone to write one and submit it for Walter to include? Because telling someone to manually parse the grammar to me is like telling someone to go read the compiler code to figure out the precedence. I know a lot of good coders who don't necessarily read language grammar specs. Even I, who understood generally what the grammar spec means, didn't get that the operator precedence was "hidden" in the grammar. I generally ignore the grammar boxes and just read the english descriptions/examples.
Oct 04 2007
Regan Heath wrote:Steven Schveighoffer wrote:Operator precendence for C++ cannot be (correctly) expressed in a linear table; a grammar is the simplest way to capture it accurately. (That may not be true for D, which has been able to keep many things simpler.) -- James"Regan Heath" wroteI think that's a good idea, the most likely to see results any time soon. I suspect operator precedence in D is almost identical to C/C++ so I'd start by copying a table for C/C++, eg. (a quick google) http://www.difranco.net/cop2220/op-prec.htmhttp://www.digitalmars.com/d/archives/12484.html <g>Hm... I guess we know Walter's opinion :) If it's just a question of not having time to do the table, would it be possible for someone to write one and submit it for Walter to include? Because telling someone to manually parse the grammar to me is like telling someone to go read the compiler code to figure out the precedence. I know a lot of good coders who don't necessarily read language grammar specs. Even I, who understood generally what the grammar spec means, didn't get that the operator precedence was "hidden" in the grammar. I generally ignore the grammar boxes and just read the english descriptions/examples.
Oct 04 2007
On 10/5/07, James Dennett <jdennett acm.org> wrote:Operator precendence for C++ cannot be (correctly) expressed in a linear tableOoh, now that's an interesting statement! Why not?
Oct 05 2007
Steven Schveighoffer Wrote:"Steven Schveighoffer" wroteThanks Steve That works perfect, funny how everything gets blurry at the end of the day. Toddif(ArincData[i].Data &0xff == 203)I just realized also that assuming D has the same operator precedence as C/C++, this really evalulates as: if(ArincData[i].Data & (0xff == 203)) Which will obviously be compiled out. So what you really want is: if((ArincData[i].Data & 0xff) == 203) BTW, I looked through the entire spec, and cannot find operator precedence anywhere. Anyone know where it is? -Steve
Oct 04 2007