4 ms·
Operator Overloading in C [pdf]
- mingodad 4y agoIt's an interesting approach to bring more expressiveness to C, this part need a bit more thought: "If any spaces or parentheses appear in the type name, they will be substituted by an underscore. Thus unsigned int will become unsigned_int the type BitInt(27) becomes BitInt_27_ ." Because "unsigned_int" (or any combination of the base types with an underscore) can already be used on user code.
- sigsev_251 4y agoThe names of the functions behind the operators use the '_' prefix which is reserved in the global namespace, so I don't really see a problem as long as the programmer stays in their lane (not using '__', '_' and libc prefixes).
- phao 4y agoI wonder how relevant operator overloading can be without things like RAII and move semantics (thinking in comparison to C++), or without some kind of managed environment. Would this be useful only for simpler and smaller objects? I'm not really familiar with more modern C. So maybe C11 (or possibly later versions) introduced a way to handle this. I'm not sure.
- butterisgood 4y agoOperator overloading is generally harmful to reading code in my experience.