top | item 46674105

(no title)

rowanG077 | 1 month ago

I thought the point of Fil-C was to be a drop in safe replacement of C. This project existing implies it isn't. What's going on?

discuss

order

pizlonator|1 month ago

Fil-C is as compatible with C as different variants of C are with one another.

The porting effort is usually a less than if you were going from 32-bit to 64-bit for the first time. For some programs, you need zero changes.

In Qt I think the changes were stuff like:

- Use an intrinsic instead of inline assembly for cpuid.

- Change how a tagged pointer works (I.e. a 64-bit value used to store some integer bits and a pointer)

(Source: I’m the Fil-C guy and I watched the Qt porting happen from the sidelines.)

wat10000|1 month ago

Most large C code bases aren’t really written in C. They’re written in an almost-C that includes certain extensions and undefined behavior. In this case, it uses inline assembly (an extension) and manipulating pointers as integers (undefined behavior).

throwaway17_17|1 month ago

While I’m always thankful when people give the broad perspective and context in a discussion, which your comment does. The specifics of this particular project’s usage of almost-C is not something I could have quickly figured out, so thanks. For such a large program, an to be as old as Qt is at this point, I find it impressive and slightly amazing that it has in some sense self-limited its divergence from standard C. It would be interesting to see what something like SQLite includes in its almost-C.

torginus|1 month ago

Afaict, there are some patterns that are not supported, like converting pointers to/from integers and doing stuff with them like bitmasks (which is a huge anti-pattern, but some code bases do it)

blub|1 month ago

QtBase is C++ first of all.

Massive projects like Qt also push compilers to their limits and use various compiler-specific and platform-specific techniques which might appear as bugs to Fil-C.

loeg|1 month ago

It isn't entirely drop-in for all programs.

meibo|1 month ago

It's not done yet.

g-mork|1 month ago

Sure fooled me. I follow his Twitter account and there isn't much he hasn't got building with it at this point. UX comes later. Amazing it's the random work of one person