Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #6378 > unrolled thread

test(void *data) vs test(void &data)

Started by"Skybuck Flying" <Windows7IsOK@DreamPC2006.com>
First post2011-06-18 22:34 +0200
Last post2011-06-21 16:03 +0200
Articles 20 on this page of 92 — 19 participants

Back to article view | Back to comp.lang.c


Contents

  test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-18 22:34 +0200
    Re: test(void *data) vs test(void &data) "Paul" <pchristor@yahoo.co.uk> - 2011-06-18 22:30 +0100
      Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-19 00:10 +0200
        Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-19 00:17 +0200
          Re: test(void *data) vs test(void &data) "Paul" <pchristor@yahoo.co.uk> - 2011-06-18 23:30 +0100
          Re: test(void *data) vs test(void &data) Angel <angel+news@spamcop.net> - 2011-06-18 22:46 +0000
            Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-19 06:06 +0200
              Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-19 06:36 +0200
                Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-19 06:40 +0200
                  Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-19 06:44 +0200
                Re: test(void *data) vs test(void &data) Stephen Sprunk <stephen@sprunk.org> - 2011-06-19 02:48 -0500
                  Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-19 15:53 +0200
                    Re: test(void *data) vs test(void &data) Stephen Sprunk <stephen@sprunk.org> - 2011-06-19 13:42 -0500
                      Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-20 07:23 +0200
              Re: test(void *data) vs test(void &data) Shao Miller <sha0.miller@gmail.com> - 2011-06-19 18:43 -0500
                Re: test(void *data) vs test(void &data) Keith Thompson <kst-u@mib.org> - 2011-06-19 17:07 -0700
                  Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-20 07:29 +0200
                Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-20 07:27 +0200
                  Re: test(void *data) vs test(void &data) Shao Miller <sha0.miller@gmail.com> - 2011-06-20 03:58 -0500
                    Re: test(void *data) vs test(void &data) "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-06-20 04:11 -0700
                      Re: test(void *data) vs test(void &data) Shao Miller <sha0.miller@gmail.com> - 2011-06-20 09:41 -0500
                    Re: test(void *data) vs test(void &data) Shao Miller <sha0.miller@gmail.com> - 2011-06-20 09:17 -0500
          Re: test(void *data) vs test(void &data) "James" <no@spam.invalid> - 2011-06-18 15:50 -0700
          Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-19 00:53 +0200
            Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-19 01:06 +0200
              Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-19 01:12 +0200
                Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-19 01:21 +0200
                  Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-19 01:29 +0200
                    Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-19 01:31 +0200
                      Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-19 01:39 +0200
                        Re: test(void *data) vs test(void &data) Shao Miller <sha0.miller@gmail.com> - 2011-06-19 18:07 -0500
                        Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-20 18:17 +0200
                          Re: test(void *data) vs test(void &data) Stephen Sprunk <stephen@sprunk.org> - 2011-06-20 13:51 -0500
                            Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-21 06:12 +0200
                              Re: test(void *data) vs test(void &data) Stephen Sprunk <stephen@sprunk.org> - 2011-06-21 07:56 -0500
                                Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-21 17:15 +0200
                                  Re: test(void *data) vs test(void &data) Stephen Sprunk <stephen@sprunk.org> - 2011-06-21 10:59 -0500
                                    Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-21 22:48 +0200
                                      Re: test(void *data) vs test(void &data) Keith Thompson <kst-u@mib.org> - 2011-06-21 15:33 -0700
                                        Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-22 02:06 +0200
                                        Re: test(void *data) vs test(void &data) Arivald <arivald_@AT_interia_DOT_.pl> - 2011-06-22 11:35 +0200
                              Re: test(void *data) vs test(void &data) Mark Storkamp <mstorkamp@yahoo.com> - 2011-06-21 08:20 -0500
                                Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-21 17:18 +0200
                            Re: test(void *data) vs test(void &data) Arivald <arivald_@AT_interia_DOT_.pl> - 2011-06-21 15:59 +0200
                              Re: test(void *data) vs test(void &data) jacob navia <jacob@spamsink.net> - 2011-06-21 16:07 +0200
                              Re: test(void *data) vs test(void &data) Keith Thompson <kst-u@mib.org> - 2011-06-21 08:06 -0700
          Re: test(void *data) vs test(void &data) Lento <lento@netfront.net> - 2011-06-19 07:21 +0800
            Re: test(void *data) vs test(void &data) "io_x" <a@b.c.invalid> - 2011-06-19 08:51 +0200
          Re: test(void *data) vs test(void &data) "io_x" <a@b.c.invalid> - 2011-06-19 08:52 +0200
          Re: test(void *data) vs test(void &data) Stephen Sprunk <stephen@sprunk.org> - 2011-06-19 03:06 -0500
            Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-19 15:57 +0200
              Re: test(void *data) vs test(void &data) Stephen Sprunk <stephen@sprunk.org> - 2011-06-19 13:41 -0500
                Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-20 07:16 +0200
      Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-19 00:25 +0200
        Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-19 00:26 +0200
          Re: test(void *data) vs test(void &data) "Paul" <pchristor@yahoo.co.uk> - 2011-06-18 23:35 +0100
            Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-19 00:49 +0200
    Re: test(void *data) vs test(void &data) Keith Thompson <kst-u@mib.org> - 2011-06-18 16:35 -0700
      Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-19 05:45 +0200
        Re: test(void *data) vs test(void &data) "James" <no@spam.invalid> - 2011-06-18 21:24 -0700
          Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-19 06:47 +0200
            Re: test(void *data) vs test(void &data) Stephen Sprunk <stephen@sprunk.org> - 2011-06-19 02:53 -0500
        Re: test(void *data) vs test(void &data) Nobody <nobody@nowhere.com> - 2011-06-19 05:37 +0100
          Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-19 06:49 +0200
            Re: test(void *data) vs test(void &data) jacob navia <jacob@spamsink.net> - 2011-06-19 08:33 +0200
              Re: test(void *data) vs test(void &data) Stephen Sprunk <stephen@sprunk.org> - 2011-06-19 02:59 -0500
            Re: test(void *data) vs test(void &data) Stephen Sprunk <stephen@sprunk.org> - 2011-06-19 02:57 -0500
            Re: test(void *data) vs test(void &data) Nobody <nobody@nowhere.com> - 2011-06-19 11:23 +0100
              Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-19 16:00 +0200
                Re: test(void *data) vs test(void &data) Stephen Sprunk <stephen@sprunk.org> - 2011-06-19 13:25 -0500
                  Re: test(void *data) vs test(void &data) jacob navia <jacob@spamsink.net> - 2011-06-19 20:37 +0200
                    Re: test(void *data) vs test(void &data) Stephen Sprunk <stephen@sprunk.org> - 2011-06-19 16:44 -0500
                    Re: test(void *data) vs test(void &data) Shao Miller <sha0.miller@gmail.com> - 2011-06-19 20:05 -0500
                      Re: test(void *data) vs test(void &data) David Thompson <dave.thompson2@verizon.net> - 2011-06-27 03:06 -0400
                        Re: test(void *data) vs test(void &data) Shao Miller <sha0.miller@gmail.com> - 2011-06-27 11:50 -0400
                  Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-20 07:31 +0200
                    Re: test(void *data) vs test(void &data) Stephen Sprunk <stephen@sprunk.org> - 2011-06-20 13:11 -0500
                    Re: test(void *data) vs test(void &data) Paul N <gw7rib@aol.com> - 2011-06-20 11:58 -0700
        Re: test(void *data) vs test(void &data) "Paul" <pchristor@yahoo.co.uk> - 2011-06-19 07:33 +0100
    Re: test(void *data) vs test(void &data) jacob navia <jacob@spamsink.net> - 2011-06-19 08:27 +0200
    Re: test(void *data) vs test(void &data) Stephen Sprunk <stephen@sprunk.org> - 2011-06-19 03:03 -0500
      Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-19 16:04 +0200
      Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-19 16:05 +0200
      Re: test(void *data) vs test(void &data) Jamie <jamie_ka1lpa_not_valid_after_ka1lpa_@charter.net> - 2011-06-19 10:53 -0400
        Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-19 17:08 +0200
        Re: test(void *data) vs test(void &data) James Kuyper <jameskuyper@verizon.net> - 2011-06-19 13:02 -0400
          Re: test(void *data) vs test(void &data) Tim Rentsch <txr@alumni.caltech.edu> - 2011-06-19 16:31 -0700
        Re: test(void *data) vs test(void &data) Stephen Sprunk <stephen@sprunk.org> - 2011-06-19 13:35 -0500
          Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-20 07:20 +0200
            Re: test(void *data) vs test(void &data) Stephen Sprunk <stephen@sprunk.org> - 2011-06-20 13:14 -0500
              Re: test(void *data) vs test(void &data) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2011-06-21 06:13 +0200
      Re: test(void *data) vs test(void &data) Arivald <arivald_@AT_interia_DOT_.pl> - 2011-06-21 16:03 +0200

Page 4 of 5 — ← Prev page 1 2 3 [4] 5  Next page →


#6415

From"Skybuck Flying" <Windows7IsOK@DreamPC2006.com>
Date2011-06-19 06:47 +0200
Message-ID<984c7$4dfd7f45$5419acc3$14030@cache6.tilbu1.nb.home.nl>
In reply to#6409

"James"  wrote in message news:itjtm4$cb9$1@speranza.aioe.org...

"Skybuck Flying" <Windows7IsOK@DreamPC2006.com> wrote in message
news:e0188$4dfd70ec$5419acc3$32187@cache6.tilbu1.nb.home.nl...
> So are you claiming that:
>
> void test( void &data )
> {
> }
>
> Does compile in either C or C++ but does not compile in either C or C++ ?

"
It is C++.
"

Right so  type * and type & are almost conceptually the same.

type * can be used for "call by reference behaviour via pointers" (which 
apperently is call by value via pointers)

type & can be used for "call by reference" ???

Does that mean & is truely call by reference ? hmmm....

Bye,
  Skybuck.

[toc] | [prev] | [next] | [standalone]


#6426

FromStephen Sprunk <stephen@sprunk.org>
Date2011-06-19 02:53 -0500
Message-ID<itk9uf$gnn$1@dont-email.me>
In reply to#6415
On 18-Jun-11 23:47, Skybuck Flying wrote:
> "James"  wrote in message news:itjtm4$cb9$1@speranza.aioe.org...
> "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> wrote in message
> news:e0188$4dfd70ec$5419acc3$32187@cache6.tilbu1.nb.home.nl...
>> So are you claiming that:
>>
>> void test( void &data )
>> {
>> }
>>
>> Does compile in either C or C++ but does not compile in either C or C++ ?
> 
> "
> It is C++.
> "
> 
> Right so  type * and type & are almost conceptually the same.

They may or may not be in C++; that is a different language discussed in
a different newsgroup.

They are not the same in C, since one is valid and the other is not.

> type & can be used for "call by reference" ???

Not in C.  If you have a question about C++, ask in a C++ newsgroup.

S

-- 
Stephen Sprunk         "God does not play dice."  --Albert Einstein
CCIE #3723         "God is an inveterate gambler, and He throws the
K5SSS        dice at every possible opportunity." --Stephen Hawking

[toc] | [prev] | [next] | [standalone]


#6411

FromNobody <nobody@nowhere.com>
Date2011-06-19 05:37 +0100
Message-ID<pan.2011.06.19.04.37.04.797000@nowhere.com>
In reply to#6406
On Sun, 19 Jun 2011 05:45:55 +0200, Skybuck Flying wrote:

> So are you claiming that:
> 
> void test( void &data )
> {
> }
> 
> Does compile in either C or C++ but does not compile in either C or C++ ?

In C++, "&" as a type qualifier is a reference, but you can't have a
reference to "void", so the above is invalid.

In C "&" as a type qualifier is invalid.

So the above isn't valid in either language.

[toc] | [prev] | [next] | [standalone]


#6416

From"Skybuck Flying" <Windows7IsOK@DreamPC2006.com>
Date2011-06-19 06:49 +0200
Message-ID<afbc5$4dfd7fe6$5419acc3$14642@cache6.tilbu1.nb.home.nl>
In reply to#6411

"Nobody"  wrote in message 
news:pan.2011.06.19.04.37.04.797000@nowhere.com...

On Sun, 19 Jun 2011 05:45:55 +0200, Skybuck Flying wrote:

> So are you claiming that:
>
> void test( void &data )
> {
> }
>
> Does compile in either C or C++ but does not compile in either C or C++ ?

"
In C++, "&" as a type qualifier is a reference, but you can't have a
reference to "void", so the above is invalid.
"

A pointer is a reference.

Do you think that's kinda odd ?

A pointer to void is allowed, but a reference to a void is not allowed ?!?

Really odd in my book.

<snip drivel>

Bye,
  Skybuck. 

[toc] | [prev] | [next] | [standalone]


#6420

Fromjacob navia <jacob@spamsink.net>
Date2011-06-19 08:33 +0200
Message-ID<itk58j$rb3$1@speranza.aioe.org>
In reply to#6416
Le 19/06/11 06:49, Skybuck Flying a écrit :
>
>
> "Nobody" wrote in message
> news:pan.2011.06.19.04.37.04.797000@nowhere.com...
>
> On Sun, 19 Jun 2011 05:45:55 +0200, Skybuck Flying wrote:
>
>> So are you claiming that:
>>
>> void test( void &data )
>> {
>> }
>>
>> Does compile in either C or C++ but does not compile in either C or C++ ?
>
> "
> In C++, "&" as a type qualifier is a reference, but you can't have a
> reference to "void", so the above is invalid.
> "
>
> A pointer is a reference.
>
> Do you think that's kinda odd ?
>
> A pointer to void is allowed, but a reference to a void is not allowed ?!?
>
> Really odd in my book.
>
> <snip drivel>
>
> Bye,
> Skybuck.

This is clear from the definition of a reference. A reference is a 
pointer to an existing object that must exist. Therefore a reference to
an inexistent object can't exist.

Plain logic. In your specific case, you can't build a void object,
so you can't have a reference to one.

On the other hand, pointers can be NULL or point to incomplete objects,
they haven't any of the constraints of references. References and
pointers are surely NOT the same.

[toc] | [prev] | [next] | [standalone]


#6428

FromStephen Sprunk <stephen@sprunk.org>
Date2011-06-19 02:59 -0500
Message-ID<itka9e$hq1$2@dont-email.me>
In reply to#6420
On 19-Jun-11 01:33, jacob navia wrote:
> This is clear from the definition of a reference. A reference is a
> pointer to an existing object that must exist. Therefore a reference to
> an inexistent object can't exist.

Jacob, please do not post off-topic material.  If you must feed the
troll, at least do so where it is topical.

S

-- 
Stephen Sprunk         "God does not play dice."  --Albert Einstein
CCIE #3723         "God is an inveterate gambler, and He throws the
K5SSS        dice at every possible opportunity." --Stephen Hawking

[toc] | [prev] | [next] | [standalone]


#6427

FromStephen Sprunk <stephen@sprunk.org>
Date2011-06-19 02:57 -0500
Message-ID<itka61$hq1$1@dont-email.me>
In reply to#6416
On 18-Jun-11 23:49, Skybuck Flying wrote:
> "Nobody"  wrote in message
> news:pan.2011.06.19.04.37.04.797000@nowhere.com...
> On Sun, 19 Jun 2011 05:45:55 +0200, Skybuck Flying wrote:
>> So are you claiming that:
>>
>> void test( void &data )
>> {
>> }
>>
>> Does compile in either C or C++ but does not compile in either C or C++ ?
> 
> "
> In C++, "&" as a type qualifier is a reference, but you can't have a
> reference to "void", so the above is invalid.
> "
> 
> A pointer is a reference.

C does not have "reference" types.  C++ may have such, but that is a
different language discussed in a different newsgroup.

C does have the concept of "pass by reference", but that just means that
a pointer (not a "reference") to an object is passed instead of the
object itself.  The C++ folks might use different terminology, but that
is better discussed in a C++ newsgroup.

S

-- 
Stephen Sprunk         "God does not play dice."  --Albert Einstein
CCIE #3723         "God is an inveterate gambler, and He throws the
K5SSS        dice at every possible opportunity." --Stephen Hawking

[toc] | [prev] | [next] | [standalone]


#6433

FromNobody <nobody@nowhere.com>
Date2011-06-19 11:23 +0100
Message-ID<pan.2011.06.19.10.22.44.266000@nowhere.com>
In reply to#6416
On Sun, 19 Jun 2011 06:49:49 +0200, Skybuck Flying wrote:

> A pointer to void is allowed, but a reference to a void is not allowed ?!?
> 
> Really odd in my book.

You can have a pointer to void, but you can't have a void. Thus a
reference to void would be meaningless; what could it refer to?

[toc] | [prev] | [next] | [standalone]


#6440

From"Skybuck Flying" <Windows7IsOK@DreamPC2006.com>
Date2011-06-19 16:00 +0200
Message-ID<9fe3b$4dfe010a$5419acc3$32606@cache5.tilbu1.nb.home.nl>
In reply to#6433

"Nobody"  wrote in message 
news:pan.2011.06.19.10.22.44.266000@nowhere.com...

On Sun, 19 Jun 2011 06:49:49 +0200, Skybuck Flying wrote:

> A pointer to void is allowed, but a reference to a void is not allowed ?!?
>
> Really odd in my book.

"
You can have a pointer to void, but you can't have a void. Thus a
reference to void would be meaningless; what could it refer to?
"

Same thing as the pointer ofcourse, duh ! ;) :)

C/C++ just sucks and is being inconsistent ! LOL.

Bye,
  Skybuck =D 

[toc] | [prev] | [next] | [standalone]


#6457

FromStephen Sprunk <stephen@sprunk.org>
Date2011-06-19 13:25 -0500
Message-ID<itlevm$ik0$1@dont-email.me>
In reply to#6440
On 19-Jun-11 09:00, Skybuck Flying wrote:
> "Nobody"  wrote in message
> news:pan.2011.06.19.10.22.44.266000@nowhere.com...
> On Sun, 19 Jun 2011 06:49:49 +0200, Skybuck Flying wrote:
>> A pointer to void is allowed, but a reference to a void is not allowed
>> ?!?
>>
>> Really odd in my book.
> 
> "
> You can have a pointer to void, but you can't have a void. Thus a
> reference to void would be meaningless; what could it refer to?
> "
> 
> Same thing as the pointer ofcourse, duh ! ;) :)
> 
> C/C++ just sucks and is being inconsistent ! LOL.

There is no such language as C/C++.

C does not have "references", so they are off-topic here.

If you wish to discuss C++, go to a C++ newsgroup.

S

-- 
Stephen Sprunk         "God does not play dice."  --Albert Einstein
CCIE #3723         "God is an inveterate gambler, and He throws the
K5SSS        dice at every possible opportunity." --Stephen Hawking

[toc] | [prev] | [next] | [standalone]


#6459

Fromjacob navia <jacob@spamsink.net>
Date2011-06-19 20:37 +0200
Message-ID<itlfkt$1gj$1@speranza.aioe.org>
In reply to#6457
Le 19/06/11 20:25, Stephen Sprunk a écrit :
>
> C does not have "references", so they are off-topic here.
>


I introduced references into lcc-win because they are useful.
Beyond this guy trolling here, his discussion allowed me to plug a hole
in my implementation, you could actually write

int fn(void &foo);

because lcc-win did not test explicitly for a void pointer.

Now I wonder what other problems may be lurking in my implementation there.


References allow you to use a much safer kind of pointers than plain 
ones. They must be initialized at their definition point, and they can't 
change afterwards, they always point to the same object.

Now, if you get a reference into a function it is NOT necessary to test 
for NULL since references can never be NULL.

This is obviously an extension but I think it is justified.

[toc] | [prev] | [next] | [standalone]


#6466

FromStephen Sprunk <stephen@sprunk.org>
Date2011-06-19 16:44 -0500
Message-ID<itlqkd$4kr$1@dont-email.me>
In reply to#6459
On 19-Jun-11 13:37, jacob navia wrote:
> Le 19/06/11 20:25, Stephen Sprunk a écrit :
>> C does not have "references", so they are off-topic here.
> 
> I introduced references into lcc-win because they are useful.

Useful or not, they are not C.

S

-- 
Stephen Sprunk         "God does not play dice."  --Albert Einstein
CCIE #3723         "God is an inveterate gambler, and He throws the
K5SSS        dice at every possible opportunity." --Stephen Hawking

[toc] | [prev] | [next] | [standalone]


#6480

FromShao Miller <sha0.miller@gmail.com>
Date2011-06-19 20:05 -0500
Message-ID<itm2sf$nm9$1@dont-email.me>
In reply to#6459
On 6/19/2011 1:37 PM, jacob navia wrote:
>
> I introduced references into lcc-win because they are useful.
> Beyond this guy trolling here, his discussion allowed me to plug a hole
> in my implementation, you could actually write
>
> int fn(void &foo);
>
> because lcc-win did not test explicitly for a void pointer.
>
> Now I wonder what other problems may be lurking in my implementation there.
>

There are other incomplete object types such as:

   typedef char foo[];
   struct bar;

Since an object of the former cannot be declared, I guess you wouldn't 
have a problem, there.

Since an object of the latter cannot be declared until 'struct bar' is 
defined, I guess you wouldn't have a problem, there.

[toc] | [prev] | [next] | [standalone]


#7026

FromDavid Thompson <dave.thompson2@verizon.net>
Date2011-06-27 03:06 -0400
Message-ID<avag075htjctrbhmt2m8s8da8u17vdblgu@4ax.com>
In reply to#6480
On Sun, 19 Jun 2011 20:05:31 -0500, Shao Miller
<sha0.miller@gmail.com> wrote:

<snip>
> There are other incomplete object types such as:
> 
>    typedef char foo[];
>    struct bar;
> 
> Since an object of the former cannot be declared, I guess you wouldn't 
> have a problem, there.
> 
> Since an object of the latter cannot be declared until 'struct bar' is 
> defined, I guess you wouldn't have a problem, there.

Objects of those incomplete types can be declared, just not defined.

Array-of-unknown-bound can be completed by an initializer in the
definition, or for a tentative definition implicitly by the t.u. end
(although that gives you array-bound-1 which isn't highly useful).

Struct-tag-only can similarly be completed before a (compatible)
definition, or for a tentative definition by the t.u. end.

[toc] | [prev] | [next] | [standalone]


#7073

FromShao Miller <sha0.miller@gmail.com>
Date2011-06-27 11:50 -0400
Message-ID<iua8us$fpc$1@dont-email.me>
In reply to#7026
On 6/27/2011 03:06, David Thompson wrote:
> On Sun, 19 Jun 2011 20:05:31 -0500, Shao Miller
> <sha0.miller@gmail.com>  wrote:
>
> <snip>
>> There are other incomplete object types such as:
>>
>>     typedef char foo[];
>>     struct bar;
>>
>> Since an object of the former cannot be declared, I guess you wouldn't
>> have a problem, there.
>>
>> Since an object of the latter cannot be declared until 'struct bar' is
>> defined, I guess you wouldn't have a problem, there.
>
> Objects of those incomplete types can be declared, just not defined.
>
> Array-of-unknown-bound can be completed by an initializer in the
> definition, or for a tentative definition implicitly by the t.u. end
> (although that gives you array-bound-1 which isn't highly useful).
>

Yes[6.9.2p2].  I suppose it would have been more accurate to have typed 
"...an object of the former cannot be constructed/produced..."

Which, incidentally, makes me curious about GCC's 'typeof'...

   typedef char a_char[];

   a_char foo;
   typeof(foo) bar;
   a_char foo = "Test";

   int main(void) {
       return sizeof bar, 0;
     }

Aha.  'bar' stays incomplete, versus with:

   typedef char a_char[];

   a_char foo;
   a_char foo = "Test";
   typeof(foo) bar;

   int main(void) {
       return sizeof bar, 0;
     }

> Struct-tag-only can similarly be completed before a (compatible)
> definition, or for a tentative definition by the t.u. end.
>

Well, it might have been clearer if I'd been explicit about context.  It 
was in regards to Mr. J. Navia's "references" and possible 
implementation problems he might have (I found one elsewhere; heh).  I'm 
not sure he'd be able to create a reference to such objects while those 
objects have only been declared with an incomplete type.  Is that a 
mistaken impression, though?

   typedef char a_char[];

   a_char foo;

   int main(void) {
       a_char & bar = &foo;
       return 0;
     }

   #if WITH_OR_WITHOUT
   a_char foo = "Test";
   #endif

[toc] | [prev] | [next] | [standalone]


#6491

From"Skybuck Flying" <Windows7IsOK@DreamPC2006.com>
Date2011-06-20 07:31 +0200
Message-ID<a2873$4dfedb18$5419acc3$22016@cache3.tilbu1.nb.home.nl>
In reply to#6457
No they are not off topic fool.

Any language idea can be discussed relating to C

Because it can always be added to the language.

I estimate your IQ to be zero.

You just a troll pretending to be dumb.

Stop it.

Anybody responding seriously to you is an even bigger fool.

Bye,
  Skybuck.

[toc] | [prev] | [next] | [standalone]


#6532

FromStephen Sprunk <stephen@sprunk.org>
Date2011-06-20 13:11 -0500
Message-ID<ito2h3$g7u$2@dont-email.me>
In reply to#6491
On 20-Jun-11 00:31, Skybuck Flying wrote:
> No they are not off topic fool.
> 
> Any language idea can be discussed relating to C

Wrong.  This newsgroup is about C; there are other newsgroups for other
languages.

> Because it can always be added to the language.

If you want to discuss adding references to C, the appropriate place is
comp.std.c.

> I estimate your IQ to be zero.

Then you would be wrong.

> You just a troll pretending to be dumb.

Pot, meet kettle.

S

-- 
Stephen Sprunk         "God does not play dice."  --Albert Einstein
CCIE #3723         "God is an inveterate gambler, and He throws the
K5SSS        dice at every possible opportunity." --Stephen Hawking

[toc] | [prev] | [next] | [standalone]


#6537

FromPaul N <gw7rib@aol.com>
Date2011-06-20 11:58 -0700
Message-ID<0a37a3f6-c198-4d50-94f2-3fb77e6842bf@b3g2000vbm.googlegroups.com>
In reply to#6491
On Jun 20, 6:31 am, "Skybuck Flying" <Windows7I...@DreamPC2006.com>
wrote:
> No they are not off topic fool.
>
> Any language idea can be discussed relating to C
>
> Because it can always be added to the language.

I used to think that comp.std.c was for questions like "What does the
standard say about ... ?" and comp.lang.c was more suited for qustions
like "Wouldn't it be nice if C had feature ... ?". It was something of
a surprise to discover they are almost exactly the opposite way round.

> I estimate your IQ to be zero.
>
> You just a troll pretending to be dumb.

Some contradiction surely?

[toc] | [prev] | [next] | [standalone]


#6419

From"Paul" <pchristor@yahoo.co.uk>
Date2011-06-19 07:33 +0100
Message-ID<OKgLp.11979$w86.5224@newsfe22.ams2>
In reply to#6406
"Skybuck Flying" <Windows7IsOK@DreamPC2006.com> wrote in message 
news:e0188$4dfd70ec$5419acc3$32187@cache6.tilbu1.nb.home.nl...
> So are you claiming that:
>
> void test( void &data )
> {
> }
>
> Does compile in either C or C++ but does not compile in either C or C++ ?
>
> Just stuff it into a console program yourself.
>
> Full source not needed.
>
No

void test( void* &data){;} 

[toc] | [prev] | [next] | [standalone]


#6418

Fromjacob navia <jacob@spamsink.net>
Date2011-06-19 08:27 +0200
Message-ID<itk4t2$q6v$1@speranza.aioe.org>
In reply to#6378
Le 18/06/11 22:34, Skybuck Flying a écrit :
> Hello,
>
> I just came across something strange.
>
> Prototypes for routines:
>
> 1: void test(void *data)
> 2: void test(void &data)
>
> The first one does compile in visual studio 2010 and the second does not.
>
> They both seem conceptually the same, like untyped variable data in
> Delphi, yet the first one is allowed and the second is not allowed.
>
> Isn't that strange ?! ;) :)
>
> Seems like case 2 is not yet implemented, either in the c/c++ language
> rules or in the compiler ?! ;)
>
> Bye,
> Skybuck.

You shouldn't be able to define a reference to void. Even if lcc-win
supports references, I should NOT compile your code... an explicit test
for the void type was missing.

Fixed.

Thanks for the discussion.

[toc] | [prev] | [next] | [standalone]


Page 4 of 5 — ← Prev page 1 2 3 [4] 5  Next page →

Back to top | Article view | comp.lang.c


csiph-web