Extending C/C++ to include new "objects"
-
I have an idea for a new extention to C/C++. I'm not going to say exactly what it is, but it's similar to how a class is an extention of a struct. My question is, how was C extended to C++ to include the class keyword? It's not just a header file/library as far as I can tell. Is there a way I can create a new concept of data/code encapsulation in a header/library without completely rewriting the compiler/linker/IDE? I'm not trying to just create a new datatype. Thanks!
-
I have an idea for a new extention to C/C++. I'm not going to say exactly what it is, but it's similar to how a class is an extention of a struct. My question is, how was C extended to C++ to include the class keyword? It's not just a header file/library as far as I can tell. Is there a way I can create a new concept of data/code encapsulation in a header/library without completely rewriting the compiler/linker/IDE? I'm not trying to just create a new datatype. Thanks!
CorvetteZ0606 wrote: how was C extended to C++ to include the class keyword? Initially, a pre compiler was written that turned C++ code into C, and it was passed to a C compiler from there. So classes would have been turned into structs. Now, the compilers are written to understand what a class is. CorvetteZ0606 wrote: Is there a way I can create a new concept of data/code encapsulation in a header/library without completely rewriting the compiler/linker/IDE? No. Christian Graus - Microsoft MVP - C++
-
CorvetteZ0606 wrote: how was C extended to C++ to include the class keyword? Initially, a pre compiler was written that turned C++ code into C, and it was passed to a C compiler from there. So classes would have been turned into structs. Now, the compilers are written to understand what a class is. CorvetteZ0606 wrote: Is there a way I can create a new concept of data/code encapsulation in a header/library without completely rewriting the compiler/linker/IDE? No. Christian Graus - Microsoft MVP - C++
Christian Graus wrote: CorvetteZ0606 wrote: Is there a way I can create a new concept of data/code encapsulation in a header/library without completely rewriting the compiler/linker/IDE? No. Well maybe there should be ;-)
-
Christian Graus wrote: CorvetteZ0606 wrote: Is there a way I can create a new concept of data/code encapsulation in a header/library without completely rewriting the compiler/linker/IDE? No. Well maybe there should be ;-)
You could write your own precompiler and add it to the MSVC++ IDE via a pre-build step.