D - constant problem
- Sean L. Palmer (12/12) Jan 28 2003 Ahh, c'mon! This is a constant expression! This used to work. I don't
- Sean L. Palmer (6/18) Jan 28 2003 In fact, I *can't* change them to enum, because of the scoping rules for
- Sean L. Palmer (5/17) Jan 28 2003 Sorry... it only complains about const uint blah = 20; if I change it t...
- Evan McClanahan (6/8) Jan 28 2003 There are constant markers (i, u, etc.) that make literals act like
Ahh, c'mon! This is a constant expression! This used to work. I don't wanna have to change all these to enums. Sean const uint D3DSP_DSTMOD_SHIFT = 20; const uint D3DSP_DSTMOD_MASK = 0x00F00000; enum D3DSHADER_PARAM_DSTMOD_TYPE { D3DSPDM_NONE = 0<<D3DSP_DSTMOD_SHIFT, // nop // ERROR: expects constant expression D3DSPDM_SATURATE= 1<<D3DSP_DSTMOD_SHIFT, // clamp to 0. to 1. range D3DSPDM_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum }
Jan 28 2003
In fact, I *can't* change them to enum, because of the scoping rules for type name in front of every usage. Sean "Sean L. Palmer" <seanpalmer directvinternet.com> wrote in message news:b15m57$aqb$1 digitaldaemon.com...Ahh, c'mon! This is a constant expression! This used to work. I don't wanna have to change all these to enums. Sean const uint D3DSP_DSTMOD_SHIFT = 20; const uint D3DSP_DSTMOD_MASK = 0x00F00000; enum D3DSHADER_PARAM_DSTMOD_TYPE { D3DSPDM_NONE = 0<<D3DSP_DSTMOD_SHIFT, // nop // ERROR: expects constant expression D3DSPDM_SATURATE= 1<<D3DSP_DSTMOD_SHIFT, // clamp to 0. to 1. range D3DSPDM_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum }
Jan 28 2003
Sorry... it only complains about const uint blah = 20; if I change it to const int blah = 20, it works!! Maybe it doesn't like the implicit cast? Sean "Sean L. Palmer" <seanpalmer directvinternet.com> wrote in message news:b15m57$aqb$1 digitaldaemon.com...Ahh, c'mon! This is a constant expression! This used to work. I don't wanna have to change all these to enums. Sean const uint D3DSP_DSTMOD_SHIFT = 20; const uint D3DSP_DSTMOD_MASK = 0x00F00000; enum D3DSHADER_PARAM_DSTMOD_TYPE { D3DSPDM_NONE = 0<<D3DSP_DSTMOD_SHIFT, // nop // ERROR: expects constant expression D3DSPDM_SATURATE= 1<<D3DSP_DSTMOD_SHIFT, // clamp to 0. to 1. range D3DSPDM_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum }
Jan 28 2003
Sean L. Palmer wrote:Sorry... it only complains about const uint blah = 20; if I change it to const int blah = 20, it works!! Maybe it doesn't like the implicit cast?There are constant markers (i, u, etc.) that make literals act like different types. Have you tried those? BTW, I'm of the opinion that anything expressed in hex should automatically be unsigned. I think that it's a more logical default type. Evan
Jan 28 2003