Post

Replies

Boosts

Views

Activity

Reply to Confusion over the `constant` memory address space and memory layout
I'm getting this error: "Program scope variable must reside in constant address space" in Xcode in a C header file. I've tried several usages of constant but can't guess the correct syntax the compiler is looking for. constant int var = 90; /unknown type name 'constant'/ __constant int var = 90; /unknown type name '__constant'/ [constant] int var = 90; /expected identifier or '('/Expected unqualified-id/use of undeclared identifier 'constant'/ [[constant]] int var = 90; /The above plus a warning: Unknown attribute 'constant' ignored/ [[__constant]] int var = 90;/Some of the above plus:Program scope variable must reside in constant address space/ static int var = 90; /* Two copies of:Program scope variable must reside in constant address space*/ What is the correct syntax to declare variables in constant address space in C header files?
Nov ’21