Re: [LTP] [PATCH 4/4] lib: add tst_res_r.c

Mike Frysinger
2014-02-14T17:16:54Z

[-- Attachment #1.1: Type: text/plain, Size: 1635 bytes --]

On Friday, February 14, 2014 17:59:14 Alexey Kodanev wrote:
> On 02/14/2014 03:06 AM, Mike Frysinger wrote:
> > On Thursday, February 13, 2014 14:05:32 Alexey Kodanev wrote:
> >> On 02/13/2014 12:47 PM, Mike Frysinger wrote:
> >>> On Tuesday, February 11, 2014 13:48:10 Alexey Kodanev wrote:
> >>>> +static int get_tst_count()
> >>>
> >>> random note: never never never use () with functions. always always
> >>> always
> >>> use (void). i'm guessing you're not aware, but what you've written here
> >>> may>
> >>>
> >>> be called (warning free!) like so:
> >>> get_tst_count(1, 2, 3);
> >>>
> >>> yes, even with -W -Wall -Wextra. please stamp this horrible habit out
> >>> of
> >>> your code.
> >>
> >> Thank you for explanation!
> >> There is a trick to try g++ to compile the code, it will throw an error
> >> on that and stops compilation.
> >
> > yeah, C++ fixed this historical wart of C. sorry for not clarifying.
> >
> > iiuc (and i could be wrong as i'm not old enough to have lived through
> > it),
> > this dates back to when C (ANSI?) didn't have prototypes. with a lot of
> > code out there relying on the behavior, gcc never stopped accepting it.
> >
> > i wonder if we could argue for like a newer GNU standard to reject it.
>
> True, what about -Wold-style-definition option? It will reveal old-style
> usage, at least would print a warning... Compiled LTP with the option,
> got 2 thousand warnings! There are truly a lot of code which is still
> using it and LTP's code one of them.

we should look at adding that to our default warning list at configure time
-mike

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 382 bytes --]

------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience. Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk

[-- Attachment #3: Type: text/plain, Size: 155 bytes --]