Curiosity...

Discussion in 'C++' started by Francesco Gallarotti, Dec 2, 2003.

  1. Reading some code today I saw this:

    static int
    CreateCompress(cinfo, version, size)
    j_compress_ptr cinfo;
    int version;
    size_t size;
    {
    jpeg_create_compress(cinfo);
    return TCL_OK;
    }

    Is this 100% equivalent to:

    static int CreateCompress(j_compress_ptr cinfo, int version, size_t size) {
    jpeg_create_compress(cinfo);
    return TCL_OK;
    }

    Have you ever seen that kind of syntax before? This was my first time...

    Francesco Gallarotti
    Francesco Gallarotti, Dec 2, 2003
    #1
    1. Advertising

  2. Francesco Gallarotti

    Jack Klein Guest

    On Tue, 02 Dec 2003 04:58:12 GMT, "Francesco Gallarotti"
    <> wrote in comp.lang.c++:

    > Reading some code today I saw this:
    >
    > static int
    > CreateCompress(cinfo, version, size)
    > j_compress_ptr cinfo;
    > int version;
    > size_t size;
    > {
    > jpeg_create_compress(cinfo);
    > return TCL_OK;
    > }


    This code is not C++, it is pre-standard C. No C++ compiler should
    accept it.

    > Is this 100% equivalent to:
    >
    > static int CreateCompress(j_compress_ptr cinfo, int version, size_t size) {
    > jpeg_create_compress(cinfo);
    > return TCL_OK;
    > }


    In C, the operation of the function is the same. But it is not 100%
    equivalent in that the first form does not create a prototype.


    > Have you ever seen that kind of syntax before? This was my first time...
    >
    > Francesco Gallarotti


    Sure, see the C Programming Language, first edition, not the second.
    And most books about C written prior to 1990, and sadly too many
    written afterwards. But it's nothing to do with C++.

    --
    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
    comp.lang.c++ http://www.parashift.com/c -faq-lite/
    alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq>
    Jack Klein, Dec 2, 2003
    #2
    1. Advertising

  3. > This code is not C++, it is pre-standard C.
    > [...] But it's nothing to do with C++.


    Sorry I didn't know it otherwise I wouldn't post it on this NG... Thanks for
    pointing it out.
    It surprises me even more that the snippet of code I post was part of a file
    named .cpp.

    Thanks,

    --Francesco
    Francesco Gallarotti, Dec 2, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?SmF5IEhpbHlhcmQ=?=

    ConfigurationManager and web.config and ASP.NET refresh curiosity

    =?Utf-8?B?SmF5IEhpbHlhcmQ=?=, Apr 5, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    887
    Brock Allen
    Apr 5, 2005
  2. =?Utf-8?B?cm9kY2hhcg==?=

    out of curiosity

    =?Utf-8?B?cm9kY2hhcg==?=, Sep 9, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    886
    =?Utf-8?B?cm9kY2hhcg==?=
    Sep 12, 2005
  3. Daisy
    Replies:
    3
    Views:
    4,051
    Steve Horsley
    Sep 12, 2005
  4. Richard
    Replies:
    2
    Views:
    369
    Jacqui or (maybe) Pete
    Jul 10, 2003
  5. Mark Adams
    Replies:
    5
    Views:
    505
    Inger Helene Falch-Jacobsen
    Aug 20, 2004
Loading...

Share This Page