Re: Question about void pointers



s0suk3@xxxxxxxxx wrote:
On Sep 16, 12:51 pm, Eric Sosman <Eric.Sosman@xxxxxxx> wrote:
s0suk3@xxxxxxxxx wrote:
On Sep 16, 12:06 pm, vippstar@xxxxxxxxx wrote:
On Sep 16, 7:59 pm, s0s...@xxxxxxxxx wrote:
On Sep 16, 11:51 am, raph...@xxxxxxxxx wrote:
On Sep 16, 4:20 pm, vipps...@xxxxxxxxx wrote:
b = ((unsigned char *)b) + 5 * sizeof *a;
I see, got to switch to char * so that it can be incremented properly.
No, to unsigned char *. But if your compiler can do it with the void
*, then do it with the void *. It's probably specialized for that kind
of stuff anyway.
You can have the "worst advice of the month" clc award.
You have two options, do it portably, or do it with an extension, with
absolutely no loss in efficiency or size, and you advice to choose the
extension.
Well, perhaps the OP doesn't need portability (or at least not this
kind of portability). Besides, void * seems more natural for this kind
of task.
"This kind of task" was an artificial bit of code specifically
written to experiment with manipulating pointers. An investigative
doodle, nothing more.


No. This "investigate doodle" demonstrated this kind of task. But this
kind of task is also common in real-world programs, and it's
important. I, for one, have actually done this, without realizing I
was using an extension.

Perhaps you should be more specific about what you mean by "this
kind of task," because I (mis?)understood you to be referring to the
code in the original post.

Personally, I'm not as ready as vippstar is to give you the
award; we're only halfway through the month. But I'd be surprised
if you weren't on the ballot a couple weeks from now. Have you
chosen your running mate yet?

I did not understand a word of that paragraph.

So you understand English as well as you understand C?

--
Eric.Sosman@xxxxxxx
.



Relevant Pages

  • Re: Question about void pointers
    ... You have two options, do it portably, or do it with an extension, with ... kind of portability). ... void * seems more natural for this kind ... This "investigate doodle" demonstrated this kind of task. ...
    (comp.lang.c)
  • Re: Question about void pointers
    ... You have two options, do it portably, or do it with an extension, with ... perhaps the OP doesn't need portability (or at least not this ... void * seems more natural for this kind ... I was referring to the task of performing pointer arithmetic on a void ...
    (comp.lang.c)
  • Re: Question about void pointers
    ... it's a matter of whether you prefer void * or char *. ... it's a matter of whether you prefer portability ... will see that a cast to char* generates none, ...
    (comp.lang.c)
  • Re: Question about void pointers
    ... You can have the "worst advice of the month" clc award. ... You have two options, do it portably, or do it with an extension, with ... perhaps the OP doesn't need portability (or at least not this ... void * seems more natural for this kind ...
    (comp.lang.c)
  • Re: Question about void pointers
    ... got to switch to char * so that it can be incremented properly. ... You have two options, do it portably, or do it with an extension, with ... kind of portability). ... void * seems more natural for this kind ...
    (comp.lang.c)