In comp.sys.raspberry-pi, Björn Lundin wrote:
> Den 2021-01-06 kl. 03:17, skrev Eli the Bearded:
>> Use a union type with an enum for which value in the value is
>> the proper one. That can easily expand to new types that are not
>> easily cast.
>
> easy ?
>
It was a complete example with variable and function declarations. A
similar complete example in another language is not likely to be
_much_ more concise, unless you count shortening identifiers.
> How someone can object to the ease of overloading is just beyond me.
Overloading can be a useful thing. I just don't think it is be-all,
end-all for the problem space, and I wanted to provide a second way the
task could be done in C besides Charlie Gibbs's "easier to just cast"
method.
I've been doing some Arduino programming recently, and while I'm writing
C, it's clearly C++ overall because of the libraries I'm using, some of
which are overloading stuff. One of those does things I find awkward
because it tries to invoke the int method at times I don't want. Eg
it wants zero to be the ASCII zero instead of ASCII null unless I write
it as "byte(0)".
Elijah
------
has been tempted to rewrite the library
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|