A quick question about comment styles

@clattner was confused by the comment styling here: llvm-project/StandardDialect.h at cb798f040a768dbd1fc918fe581088b2fe7932bf · llvm/llvm-project · GitHub

His question verbatim:

Ok, I see the MLIR C bindings are doing the same thing, but this still seems a bit weird to me: The use of /**/ comments is very inclusive to old C compilers, but I think that BCPL style // comments were part of ansi c 89/90, so I think they are ok to use. Doing so gets us better alignment with the c++ side of things. Could you ask the MLIR forum what the rationale here is, and whether using // would be ok with them?

I’m supportive of consistency, but otherwise don’t really care. Is there a specific policy here?

This is conservative with respect to the public C headers (that makes them compatible with -pedantic -std=c89 -Werror I believe). We modeled around LLVM public C header here, for example: https://github.com/llvm/llvm-project/blob/master/llvm/include/llvm-c/Target.h

1 Like

That being said, we also use intptr_t, which is C99 (not that it can’t be added with a local typedef).

Just MHO, but I think that LLVM is just old and wrong here. I think it would make sense for MLIR to just embrace (reasonable) C features. A good subset is probably “whatever is supported by MSVC”.

I’m fine with this as well, let me work on a revision for this.

Here is an attempt: https://reviews.llvm.org/D90732

Wow, amazing work Mehdi!