On 11/2/22 12:42 AM, Mike Parker wrote:
Walter said that ImportC doesn't support head const. His experience with C is that people generally mean const in C to be transitive. So in ImportC, he turned the head const cases into transitive const and it appears to work well.

On one of the only articles using ImportC (which otherwise shines a positive light on the feature), this specific issue is the only one that comes up as a blocker:

https://briancallahan.net/blog/20220704.html

Specifically in the "running make" part:

There was one more file that DMD couldn't compile:

dmd -g -O -P=-DEMACS -P=-DVI -ofexpr.o -c expr.c
expr.c(204): Error: cannot modify `const` expression `(*es).tok`
expr.c(205): Error: cannot modify `const` expression `(*es).val`

I wonder if this is a bug in ImportC. No other C compiler we've tried fails on 
this code.

Having translated C code myself, and running into const issues where I've had to cast away const, I do not think this is a wise decision. Walter should reconsider. An ImportC that can't compile pretty standard C code as-is is nearly useless.

-Steve

Reply via email to