Syntactically both treat struct
almost the same. Only C++ has added an extra rule that allows to omit the struct
(and class
) keyword if there is no ambiguity.
If there is ambiguity, also C++ requires the struct
keyword in some places. A notorious example is stat
on POSIX systems where there is a struct stat
and a function stat
.
Related Contents:
- How does the compilation/linking process work?
- What’s the difference between __PRETTY_FUNCTION__, __FUNCTION__, __func__?
- Where are static variables stored in C and C++?
- “No newline at end of file” compiler warning
- How are GCC and g++ bootstrapped?
- Compiling with g++ using multiple cores
- What is difference between sjlj vs dwarf vs seh?
- Can a recursive function be inline?
- how does array[100] = {0} set the entire array to 0?
- Qt: can’t find -lGL error
- How to create a static library with g++?
- (A + B + C) ≠ (A + C + B) and compiler reordering
- Why is it impossible to build a compiler that can determine if a C++ function will change the value of a particular variable?
- Visual Studio: LINK : fatal error LNK1181: cannot open input file
- Why is this C++ program so incredibly fast?
- C / C++ compiler warnings: do you clean up all your code to remove them or leave them in?
- “g++” and “c++” compiler
- Update GCC on OSX
- Multi-line DEFINE directives?
- Why is so much space allocated on the stack?
- Portability of #warning preprocessor directive
- Disabling g++’s return-value optimisation
- C++ variable has initializer but incomplete type?
- what is “stack alignment”?
- Do unused functions get optimized out?
- Why don’t C++ compilers do better constant folding?
- Why is (void) 0 a no operation in C and C++?
- Why do compilers duplicate some instructions?
- fatal error C1010 – “stdafx.h” in Visual Studio how can this be corrected?
- Template within template: why “`>>’ should be `> >’ within a nested template argument list”
- What do C and Assembler actually compile to? [closed]
- What is Linux utility to mangle a C++ symbol name?
- C++ : Difference between linking library and adding include directories
- shared_ptr: horrible speed
- is there any way to disable compiler optimisation for a specific line of code?
- For { A=a; B=b; }, will “A=a” be strictly executed before “B=b”?
- Constants and compiler optimization in C++
- Setting default compiler in CMake
- Why don’t the C or C++ standards explicitly define char as signed or unsigned?
- C++11 Compiler: Closest to the standard and how close?
- How can the compile-time be (exponentially) faster than run-time?
- What’s safe for a C++ plug-in system?
- Best compiler warning level for C/C++ compilers? [closed]
- C++ iterators & loop optimization
- Can placement new for arrays be used in a portable way?
- What issues can I expect compiling C code with a C++ compiler?
- What does vectorization mean?
- Operator new initializes memory to zero
- Camera position in world coordinate from cv::solvePnP
- Including header files in C/C++ more than once [duplicate]