online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl, C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog. Code, Compile, Run and Debug online from anywhere in world. GS 15 Jan. 2022 See: https://stackoverflow.com/questions/70727668/bizarre-struct-member-packing-in-32-bit-clang *******************************************************************************/ #include <iostream> struct _8Bytes { uint64_t _8bytes; }; struct _16Bytes : _8Bytes { uint32_t _4bytes; }; struct _16Bytes2 { uint64_t _8bytes; uint32_t _4bytes; }; struct Test : _16Bytes { uint8_t test; }; struct Test2 { uint64_t _8bytes; uint32_t _4bytes; uint8_t test; }; struct Test3 : _16Bytes2 { uint8_t test; }; int main() { printf("sizeof(_8Bytes) = %lu\n", sizeof(_8Bytes)); printf("sizeof(_16Bytes) = %lu\n", sizeof(_16Bytes)); printf("sizeof(_16Bytes2) = %lu\n", sizeof(_16Bytes2)); printf("sizeof(Test) = %lu\n", sizeof(Test)); printf("sizeof(Test2) = %lu\n", sizeof(Test2)); printf("sizeof(Test3) = %lu\n", sizeof(Test3)); printf("\n"); printf("offsetof(Test, test) = %lu\n", offsetof(struct Test, test)); printf("offsetof(Test2, test) = %lu\n", offsetof(struct Test2, test)); printf("offsetof(Test3, test) = %lu\n", offsetof(struct Test3, test)); return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue