Re: compilers and unused args in functions

2024-07-06 Thread David Holland
On Fri, Jul 05, 2024 at 04:19:57PM +0200, ??? wrote: > Then you need to update your knowledge: this is now standard C23. It's a pity that C23 includes a handful of reasonable things along with all the foolishness. It would be easier for everyone to just ignore it entirely. -- David A. Holland d

Re: compilers and unused args in functions

2024-07-05 Thread Greg A. Woods
At Fri, 5 Jul 2024 10:03:05 -0400 (EDT), Mouse wrote: Subject: Re: compilers and unused args in functions > > One is > > (void)arg; This is, in my opinion, the one correct way to explicitly and with intent "use" an otherwise unused variable or parameter. It is afte

Re: compilers and unused args in functions

2024-07-05 Thread наб
On Fri, Jul 05, 2024 at 10:03:05AM -0400, Mouse wrote: > In...C++, I think it is?, you can do this by declaring the unused arg > without a name, as in > > void fxn(int arg1, int) > { > ... > } > > but as far as I know nobody's picked that up in C. (It strikes me as a > very sensible approach.)

Re: compilers and unused args in functions

2024-07-05 Thread Mouse
> One of those functions needs a 2nd arg, which means that to keep > compatible function profiles these days, I need to add the extra arg > to all of them Or complicate the call sites, yes. > In the ancient past I would have just added an extra arg to the one > that needs it, and the call site, a

Re: compilers and unused args in functions

2024-07-05 Thread Robert Elz
Date:Fri, 5 Jul 2024 10:20:23 +0200 From:=?UTF-8?Q?J=C3=B6rg_Sonnenberger?= Message-ID: | How do you know which functions take one argument and which two? They all take two now. That was the question (now answered) - what should I do with the extra arg in those

Re: compilers and unused args in functions

2024-07-05 Thread Jörg Sonnenberger
On 7/5/24 6:36 AM, Robert Elz wrote: In sh, I have a whole set of functions that are called via a function pointer in a data struct (*p->func)(arg); One of those functions needs a 2nd arg, which means that to keep compatible function profiles these days, I need to add the extra arg t

Re: compilers and unused args in functions

2024-07-04 Thread Robert Elz
Date:Fri, 5 Jul 2024 08:00:46 +0200 From:Roland Illig Message-ID: | Do you really need all these functions in a single table? Yes. This is for when a variable is set, the var struct has a function for those few variables that need some special action to be taken

Re: compilers and unused args in functions

2024-07-04 Thread Roland Illig
Am 05.07.2024 um 06:36 schrieb Robert Elz: > In sh, I have a whole set of functions that are called > via a function pointer in a data struct > > (*p->func)(arg); > > One of those functions needs a 2nd arg, which means that > to keep compatible function profiles these days, I need > to add th

Re: compilers and unused args in functions

2024-07-04 Thread Valery Ushakov
On Fri, Jul 05, 2024 at 11:36:06 +0700, Robert Elz wrote: > So, now I have all these functions (but one) with an arg they don't > need, and have no use for. > > I could add something stupid like > arg = arg; > or something to use the value (but then the compiler is likely to > warn about ar