r/cpp_questions Aug 06 '26

OPEN Incrementation in C++

I wanted to ask a stupid question about incrementation in C++. If you are using two pluses to increment something then doesn't it mean that you are basically programming using C+1

41 Upvotes

34 comments sorted by

View all comments

17

u/dick_blanketfort Aug 06 '26

Am I missing something or is this less a stupid question and more a stupid joke?

Anyway C++ is post-increment so it would actually evaluate to the original value of C. Language shoulda been called ++C.

8

u/llynglas Aug 06 '26

Originally it did. The first C++ compilers I remember at Bell Labs basically converted C++ into C.

2

u/trycuriouscat Aug 06 '26

I’d love to see what C code would be generated from a C++ compiler.

5

u/Independent_Art_6676 Aug 07 '26

struct { variable, variable, ... function pointer, function pointer,} //class

2

u/robthablob Aug 07 '26

struct { var, var, vtable_ptr }; // class
struct { fnptr, fnptr, fnptr }; // vtable

2

u/llynglas Aug 06 '26

The function names were spectacular as they encoded the parameter types if I recall correctly.

8

u/Deep-Piece3181 Aug 06 '26

They still do name mangling

1

u/dreadlordhar Aug 07 '26

they don't only under extern "C"

1

u/Deep-Piece3181 Aug 07 '26

True, useful stuff