Re: A: a new bug to old plain C

Segher Boessenkool <[email protected]>
Newsgroups gmane.comp.gcc.help
Message-ID <aTXszwjxaOCFwleC@gate>
Hi!

On Sun, Dec 07, 2025 at 11:39:59AM -0800, Andrey Tarasevich via Gcc-help wrote:
> In order to signal the compiler that "you clearly understand what you are doing" 
> in this particular situation you have to use an explicit cast.

The best way (or the only way really) is to not use a compiled language
at all, but to use machine code instead, or *maybe* assembler language.

> There are lots and lots of 
> conversions in C that are only available through _explicit_ _casts_

Where "lots and lots" means "exactly zero": you can always do an
ssignment to something with an appropriate type.

Explicit casts are exceptional, and that is how they should be used.
Whenever you see one, you know something unusual is going on.  Implicit
casts can be treacherous that way (but they are prefered often).  Good
taste cannot be taught, all that.

(This is assuming you're looking at reasonable code of course.  Oh
well).


Segher
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.