Skip to main content

Questions tagged [struct]

Filter by
Sorted by
Tagged with
0 votes
1 answer
150 views

structs are great, the only problem is that not only do they associate data (topo)logically, they also crystallise a memory layout for that set of concepts. I would like to avoid the latter. So I'm ...
Engineer's user avatar
  • 781
7 votes
2 answers
4k views

In C you cannot assign arrays directly. int array[4] = {1, 2, 3, 4}; int array_prime[4] = array; // Error At first I thought this might because the C facilities were supposed to be implementable with ...
CPlus's user avatar
  • 1,219
27 votes
9 answers
9k views

I have always wondered whether public, protected, and private has security implications post compilation. Hypothetically: class Foo { public: int m_Foo; // Completely vulnerable and dangerous ...
Anon's user avatar
  • 3,649
11 votes
1 answer
2k views

During my investigations of List<T> enumeration I noticed List<T>.Enumerator is struct. In opposite for instance to System.Array.SZArrayEnumerator or System.SZArrayHelper....
Yarl's user avatar
  • 298
5 votes
3 answers
2k views

I have a business object which is basically a wrapper around a value of type int. There are some constraints for the value/object: Not every value in int's range is valid1 The valid values are not a ...
Bill Tür stands with Ukraine's user avatar
-1 votes
1 answer
250 views

I came across this Enum and Struct declarations in a project supposedly done by an expert. The declarations / definitions are little different than what im used to so far. enum EnumKeys { KEY_MENU ,...
ABCD's user avatar
  • 117
7 votes
0 answers
427 views

In the Rust documentation, under the structs section, they give this example of how structs need lifetimes when they contain references: struct Foo<'a> { x: &'a i32, } because We need ...
user avatar
184 votes
5 answers
178k views

What are your rules of thumb for when to use structs vs. classes? I'm thinking of the C# definition of those terms but if your language has similar concepts I'd like to hear your opinion as well. I ...
RationalGeek's user avatar
  • 10.1k