Re:Operator Overloading in C [pdf]
by mingodad on Saturday August 20, 2022 @04:53AM
(#32530505)
It'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.
Re:Operator Overloading in C [pdf]
by sigsev_251 on Sunday August 21, 2022 @08:59AM
(#32539709)
The 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).
Re:Operator Overloading in C [pdf]
by phao on Saturday August 20, 2022 @07:01AM
(#32531050)
I 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.
"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.
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.