digitalmars.D.learn - Bitfileds Error: no identifier for declarator
- data pulverizer (44/44) Oct 27 2021 Hi,
- data pulverizer (36/38) Oct 27 2021 Sorry forgot to prepend:
- Imperatorn (3/6) Oct 27 2021 Try renaming debug to something else
- Imperatorn (2/10) Oct 27 2021 uint, "debugflag", 1,
- data pulverizer (2/3) Oct 27 2021 Many thanks guys. I should have spotted that one!
- Stanislav Blinov (4/13) Oct 27 2021 `debug` is a language keyword, try a different one, like "debug_".
Hi,
I am trying to compile the following items:
```
import std.bitmanip: bitfields;
enum TYPE_BITS = 5;
enum NAMED_BITS = 16;
struct sxpinfo_struct {
mixin(bitfields!(
SEXPTYPE, "type", TYPE_BITS,
uint, "scalar", 1,
uint, "obj", 1,
uint, "alt", 1,
uint, "gp", 16,
uint, "mark", 1,
uint, "debug", 1,
uint, "trace", 1,
uint, "spare", 1,
uint, "gcgen", 1,
uint, "gccls", 3,
uint, "named", NAMED_BITS,
uint, "extra", 32 - NAMED_BITS));
}
```
But I get the error:
```
Error: no identifier for declarator `uint`
Error: identifier or integer expected inside `debug(...)`, not `)`
Error: found ` ` when expecting `)`
Error: no identifier for declarator `safe`
Error: declaration expected, not `return`
Error: no identifier for declarator `void`
Error: identifier or integer expected inside `debug(...)`, not
`uint`
Error: found `v` when expecting `)`
Error: declaration expected, not `)`
Error: declaration expected, not `assert`
Error: basic type expected, not `cast`
Error: found `cast` when expecting `;`
Error: declaration expected, not `(`
```
All referencing the `bitfields` `mixin`, more specifically the
last two lines but I think it's actually referencing the expanded
`mixin` rather than my declaration.
Thanks
Oct 27 2021
On Thursday, 28 October 2021 at 05:20:35 UTC, data pulverizer wrote:Hi, I am trying to compile the following items ...Sorry forgot to prepend: ``` enum SEXPTYPE { NILSXP = 0, SYMSXP = 1, LISTSXP = 2, CLOSXP = 3, ENVSXP = 4, PROMSXP = 5, LANGSXP = 6, SPECIALSXP = 7, BUILTINSXP = 8, CHARSXP = 9, LGLSXP = 10, INTSXP = 13, REALSXP = 14, CPLXSXP = 15, STRSXP = 16, DOTSXP = 17, ANYSXP = 18, VECSXP = 19, EXPRSXP = 20, BCODESXP = 21, EXTPTRSXP = 22, WEAKREFSXP = 23, RAWSXP = 24, S4SXP = 25, NEWSXP = 30, FREESXP = 31, FUNSXP = 99 } ``` In case someone is trying to replicate the error.
Oct 27 2021
On Thursday, 28 October 2021 at 05:20:35 UTC, data pulverizer wrote:Hi, I am trying to compile the following items: [...]Try renaming debug to something else
Oct 27 2021
On Thursday, 28 October 2021 at 05:51:27 UTC, Imperatorn wrote:On Thursday, 28 October 2021 at 05:20:35 UTC, data pulverizer wrote:uint, "debugflag", 1,Hi, I am trying to compile the following items: [...]Try renaming debug to something else
Oct 27 2021
On Thursday, 28 October 2021 at 05:51:27 UTC, Imperatorn wrote:Try renaming debug to something elseMany thanks guys. I should have spotted that one!
Oct 27 2021
On Thursday, 28 October 2021 at 05:20:35 UTC, data pulverizer
wrote:
I am trying to compile the following items:
struct sxpinfo_struct {
mixin(bitfields!(
// ...
uint, "debug", 1,
// ...
}
```
But I get the error...
`debug` is a language keyword, try a different one, like "debug_".
That error message though, much wow.
Oct 27 2021









data pulverizer <data.pulverizer gmail.com> 