3 ms·
> [..] another comment sequence void alloc1() //[ .alloc result; ] // it allocates! If the annotation opening block is always `//[` you have intuitive C c
by ithkuil 3y ago
> [..] another comment sequence
void alloc1() //[ .alloc result; ] // it allocates!
If the annotation opening block is always `//[` you have intuitive C comments within that line (either another line comment or a /* / section inside that line. Multiline /*/ comments starting on that line wouldn't be allowed but that would be following the established C preprocessor rules and thus won't surprise any user nor editor/syntax-highlighter.
That said, I do agree with your concerns around first-class-ness of syntax annexes for language extensions.
The main advantage of using some form of hack exploiting comments is that the existing ecosystem (syntax-highligters, code formatters, auto completion, ...) would keep working. But how code auto formatters would work depend on the details. E.g. I didn't try how would popular auto formatters handle the example above.