Path: csiph.com!news.mixmin.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c++
Subject: Re: ???Microsoft Azure CTO Mark Russinovich: C/C++ should be deprecated???
Date: Sun, 09 Oct 2022 08:33:20 -0700
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <86h70dhv0f.fsf@linuxsc.com>
References: <871qs3za1l.fsf@bsb.me.uk> <87pmfnxlt0.fsf@bsb.me.uk> <868rlyj8xd.fsf@linuxsc.com> <7e3900e7-358f-440b-9afe-57d42b095a03n@googlegroups.com> <86lepri6hs.fsf@linuxsc.com> <87a2ad16-df85-4b29-bdbd-0fa774c1a980n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader01.eternal-september.org; posting-host="5776cd068cf8ba5acde660884036e904"; logging-data="566021"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18eyBUIdONxIAdXST//yLztZYCtLDGTtWo="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:y0fPylJ3yaycMIwtk/GgdaxMyqk= sha1:2c03emb+1G5b77NwsYvB7Kwakfc=
Xref: csiph.com comp.lang.c++:86846
Michael S writes:
> On Saturday, October 8, 2022 at 2:01:05 AM UTC+3, Tim Rentsch wrote:
[...]
>> Not that I disagree necessarily, but can you say what it is about
>> function overloading you don't like? (For the time being let's
>> ignore the larger topic of polymorphism with templates.)
>
> Difficulty (for human reader) to find out which of name-sakes is
> called at given place. [...]
If the different overloadings all provide what is conceptually
the same operation, is it important to know which one is called?
For example, if we have
size_t read_bytes_into( void *out, size_t n, FILE *file );
size_t read_bytes_into( void *out, size_t n, int fd );
should a caller care which of the two functions is called? At
some level that seems to be a violation of the principle of
information hiding.
Of course, if the different overloadings do not all provide the
same conceptual operation, that is a problem in program design.
Is your objection only for cases in this second category?
(A problem with file descriptors being of 'int' type is that any
old arithmetic expression can be used, and the argument value may
not be a suitable file descriptor. But that problem is inherent
is using 'int' file descriptors, regardless of whether there is
function overloading.)