Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Curiosity...

Reply
Thread Tools

Curiosity...

 
 
Francesco Gallarotti
Guest
Posts: n/a
 
      12-02-2003
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


 
Reply With Quote
 
 
 
 
Jack Klein
Guest
Posts: n/a
 
      12-02-2003
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>

 
Reply With Quote
 
 
 
 
Francesco Gallarotti
Guest
Posts: n/a
 
      12-02-2003
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57