Curiosity...

  • Thread starter Francesco Gallarotti
  • Start date
F

Francesco Gallarotti

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
 
J

Jack Klein

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>
 
F

Francesco Gallarotti

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top