How to disable a block of code from compilation and syntactical analysis aka /* <code> */

The subject says it (nearly) all:

I want to “multiline comment” (I know, there is no // in Zig) a block of code prepend each and every line with //.

How can I do this?

Cheers!
Tuxic

As far as I know, You can not do that. This is because it is easier this way for the parser.

I thought about “commenting by code” way, like

if (false) {
    // never executed
}

but, of course, code inside the block must be correct anyway.

@dee0xeed gave good advice. Another way is simply to have an editor that can comment out a selection. Single line or multi line won’t make a difference at that point.

Hi,

imagine I would have the #define/#ifdef/#undef in a C-code:
#undef DEBUG
#ifdef DEBUG
// chunk of code
#endif
#undef
#define ACCESSREGISTERSDIRECTLY
#ifdef ACCESSREGISTERSDIRECTLY
// chunk code
#endif
#undef
#undef DUMPREGSINLOG
#ifdef
// chunk of code
#endif

and would now get in Zig this instead:
// chunk of code
// chunk of code
// chunk of code

…I assume, the former is more readable, more clear.

The disadvantages of haveing a preprocessore is not due to the preprocessor but is (mis-) use is
the hands of the programmer.
You can write FORTRAN programs in any language.

Only my two cents…

Cheers!
Tuxic

There are more considerations than just potential abuse from programmers, like for example tooling support for this kind of stuff. Not having macros of this kind helps simplify syntax highlighters, just to name one example.