I’m trying to figure out a way to use nested global structs as a sort of API namespacing for my C library.
Specifically, I want to expose a single Primary ‘namespacing struct,’ ... |
I'm editing a piece of code, that is part of a big project, that uses "const's" to initialize a bunch of arrays.
Because I want to parametrize these const's I have to ... |
I can initialize float32x4_t like this:
const float32x4x4_t zero = { 0.0f, 0.0f, 0.0f, 0.0f };
But this code makes an error Incompatible types in initializer:
const float32x4x4_t one =
{
1.0f, ...
|
What does const struct mean? Is it different from struct?
|
I write a struct
struct Tree{
struct Node *root;
struct Node NIL_t;
struct Node * const NIL; //sentinel
}
I want
struct Node ...
|
I am familiar with structs and arrays in c, however I have no idea what is going on in the below code. The order for struc declaration is usually:
struct employee ...
|
I'm curious why the following code snippet doesn't compile:
typedef struct Foo {
int a;
int b;
} Foo;
static const Foo FooZero = { 0, 0 ...
|
|
Can someone tell me the difference between these two versions of a declaration of a structure?
struct S
{
uint8_t a;
};
and
const struct S
{
uint8_t a;
}
Followed by:
void main(void)
{
struct S s ...
|
Hi everyone, I have a problem. If I declare a struct with a const member, what will happen?For example: if I declared a struct like following: struct{ const int a; char c; }aStruct; then such statement as aStruct.a = 0; is illegal. But I can printf the value of a, it's always the same value no matter how many times I ... |
Hi Sick0Fant, and thanks for your reply. If I initialized it as you proposed, then it would be the same accross all instances of Example objects. However, by const I merely mean to enforce that, once initialized, the struct should not change. It will, however, hold different values accross different instances of Example. Do you know how I may initialize such ... |
Hi, Hi, I have a typedefed struct, and later when I declare multiple const structures and want to use a field of one in an inialization, I get the following error: "error C2099: initializer is not a constant". typedef struct { int Start; int attribute; } MyStructure ; #define FIRST 1 const MyStructure STRUCT0={FIRST, 0} ; const MyStructure STRUCT1={STRUCT0.Start+5, 25} ; ... |
Hi, Sorry, not very clear from the title but wasn't sure what to call it. I was experimenting with the following in GCC 4.0.1 and didn't achieve what I expected. I was trying to keep the internal class private, to prevent creation, but also in the hope it might achieve something like when you use "class ;" to early declare to ... |
dj Perhaps this question should be in the standard c newsgroup, but i hope somebody answers it here. Anyway, I came across this situation in an otherwise c++ code. I need a struct that works like some sort of a flag set. The flag mask is a single long, while the meaning of individual flags is given by static const members ... |
I have 3 different structures with each structure having the same first member (int type). I would like every structure of type 1 to have a 1 in the type field, every structure of type 2 to have 2 in the type field etc. I want instances of each structure to have the type value properly initialized, and I also want ... |
Hello every one. I'm developing a menu system for a embedded device. i designed a struct and some core functions. i need all menu items in ordered some way. but when i try to compile this code faced with error { initializer element is not a constant }. here is sample code with comments. how can i solve this problem. (complier ... |