This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug manual/13058] New: Examples in glibc manual are inconsistent in declarations of main()


http://sourceware.org/bugzilla/show_bug.cgi?id=13058

           Summary: Examples in glibc manual are inconsistent in
                    declarations of main()
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: minor
          Priority: P2
         Component: manual
        AssignedTo: roland@gnu.org
        ReportedBy: rafe.kettler@gmail.com


Created attachment 5876
  --> http://sourceware.org/bugzilla/attachment.cgi?id=5876
Patch for main() signatures in glibc manual. Generated by git diff

Different examples in the manual use varying declarations for main(), some of
which are outdated or non-standard.

manual/examples/longopt.c uses a pre-standard declaration for main like so:

    int 
    main(argc, argv)
         int argc;
         char **argv;

manual/examples/strncat.c uses a main() with no return type declared:

    main()

Those are the only examples that are blatantly anachronistic. There is one more
inconsistency in manual/examples/subopt.c, however, which uses a a different
style for declaring main than all of the other examples. subopt.c uses:

    int 
    main(int argc, char *argv[])

while all of the other examples use:

    int main(int argc, char **argv)

The former is inconsistent with the latter, and the latter is inconsistent with
the GNU coding standards.

Attached is a patch (generated by `git diff > main_signatures.patch` that
changes the signature of every main() in the examples to be either:

    int
    main (void)

or

    int
    main (int argc, char **argv)

Thanks for your time.

PS: if someone needs a different kind of patch, I'd be happy to generate a
different kind of patch.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]