Which of the C-family languages have a preprocessor?
Among the C-syntax family of languages (C, C++, Java, C#, ObjC, JS, AS, ...), which hav开发者_StackOverflow中文版e a preprocessor compatible (to whatever extent) with the C preprocessor?
Objective C is a superset of the C language and was initially implemented as an additional preprocessor to C code. It is fully compatible with C preprocessor.
None of the others you name have preprocessors compatible with the C spec. Keep in mind that preprocessors are an assembler/compiler-specific thing in many cases, and the functionality you are looking for may or may not be found in different, proprietary IDEs/Compilers.
Of course, C++ is 100% (more or less) compatible as well.
C++ and objective-C both use the C preprocessor, none of the others do.
You can always add a macro processor or template language to any build process if you need it.
Java and JS have no preprocessor (JS understandably, really, since you can run strings as code in-language). Not sure about AS, but C, C++, and ObjC all have a C-grade preprocessor.
C# does have a preprocessor, but I've never used it, and thus cannot talk about it's use. http://msdn.microsoft.com/en-us/library/ed8yd1ha(VS10.0).aspx
The Boost preprocessor library is awesum.
精彩评论