hirrolot / datatype99

Algebraic data types for C99
MIT License
1.38k stars 23 forks source link

howto deal with unused variables #4

Closed picca closed 3 years ago

picca commented 3 years ago

Hello, I match a constructor but, I do not need all the parameters

        match(detector){
                of(Detector, _, shape, _){
                        *width = shape->width;
                        *height = shape->height;
                }
        }

So when Compiling, I have a lot's of

hkl-binoculars-detectors-2d.c:440:17: warning: unused variable ‘_’ [-Wunused-variable]
  440 |                 of(Detector, _, shape){
      |  

So is there a better solution than switching off the unused-variable in order to silent this message. Maybe a dedicated _ variable with an unused annotation ?

Cheers

Fred

hirrolot commented 3 years ago

Hmm, actually a reserved variable name _ seems to be a good solution. I've just implemented it -- you can pull the latest changes and use it.

picca commented 3 years ago

It works great,

thanks