sizeof
Does sizeof work at compile time?
I ran this sample program. const int x = 5; int main(int argc, char** argv) { int x[x]; int y = sizeof(x) / sizeof(int);[详细]
2023-03-30 14:22 分类:问答Determine `sizeof float` without compilation
I\'d like to know the size of a float in GCC, without having to run the compiler. I know one option is to write a small function and have the compiler print out an assembly listing.[详细]
2023-03-30 10:38 分类:问答sizeof and pass-by-reference
I am hoping that someone can explain the following behaviour. Suppose I am trying to implement a function which determines the length of any array, but want to avoid using macros. For e.g[详细]
2023-03-27 18:08 分类:问答C++: getting the row size of a multidimensional array passed to a function
I\'m trying to write a function that will print out the contents of a multidimensional array. I know the size of the columns, but not the size of the rows.[详细]
2023-03-25 07:44 分类:问答Can I assume sizeof(GUID)==16 at all times?
The definition of GUID in the windows header\'s is like this: typedef struct _GUID { unsigned long Data1;[详细]
2023-03-25 04:52 分类:问答What is meant by "Nominal storage allocation" in the context of primitive data type allocation size?
Looking at this table describing the data types in VB. One of the columns is labeled \"Nominal s开发者_如何学Pythontorage allocation\".What does this mean?Why is the word \"nominal\" here?I believe t[详细]
2023-03-24 16:16 分类:问答Size of classes with virtual functions GCC/Xcode
Can anyone explain to me what is going on here? First off, I think most programmers know that a class with a virtual function has a vtbl and thus has 4 extra bytes on the top of it. As far as I know,[详细]
2023-03-24 01:07 分类:问答Conditional Compilation and compile time evaluation of expressions in ANSI C
I would like to do the following, but the compiler doesn\'t like it: unsigned short foo = 1; // do something with foo[详细]
2023-03-23 02:52 分类:问答C - sizeof() on static char arrays inside a struct - impossible?
I need to store two items per array element — two arrays of char, which might contain null bytes — and then still be able to use sizeof() to get their length.Since these values will not ch[详细]
2023-03-22 23:24 分类:问答Behaviour of Sizeof in C
I have learnt that when we pass the array name to sizeof, the name of the array does not decay to the pointer to base address. The code below verifies this fact by giving answer 10.[详细]
2023-03-22 20:53 分类:问答