From: porkchop@invalid.foo   
      
   On Tue, 6 Jan 2026 15:47:41 +0200, Michael S wrote:   
      
   > On Tue, 6 Jan 2026 12:32:43 -0000 (UTC)   
   > Michael Sanders wrote:   
   >   
   >> On Mon, 5 Jan 2026 08:39:53 -0000 (UTC), Michael Sanders wrote:   
   >>   
   >> > I might have questions down the road...   
   >>   
   >> One more question, but 1st the context...   
   >>   
   >> I asked ChatGPT this question:   
   >>   
   >> In C, what is the most common meaning of (void) *foo   
   >>   
   >> Its reply:   
   >>   
   >> In C, (void) *foo most commonly means:   
   >>   
   >> “Evaluate *foo, but explicitly discard its value.”   
   >>   
   >> It is a cast-to-void used to silence warnings about an   
   >> unused expression or unused result.   
   >>   
   >> My question: Why?   
   >>   
   >   
   > Why what?   
      
   If its unused, by definition its /unused/...   
      
   > There exist a need to selectively silence otherwise useful compiler   
   > warnings. There are no standard ways to do it.   
   > So compilers gave to user ways to express their wishes.   
   >   
   > I would speculate that in case of this particular pattern it happened   
   > initially by accident - users found a way to exploit weakness in   
   > compiler's warning logic to achieve desired effect.   
   > Since the usage became widespread, compiler vendors paid attention and   
   > turned accidental behavior into semi-official.   
      
   I cant help but think this is the reason too.   
      
   > There is similar convention w.r.t. unused function parameters that is   
   > even more widespread.   
   >   
   > Does it answer your question or you already knew that and asked about   
   > something else?   
      
   Well, lots of you guys here either do or/did this for a living.   
   Me? I'm a weekend warrior as it were, so lots of questions about   
   some of those dark corners...   
      
   --   
   :wq   
   Mike Sanders   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|