Re: Question about void pointers



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.

     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.

Sebastian

.



Relevant Pages

  • 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 ... 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
    ... 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
    ... 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)
  • 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: C Program [ Turbo-C ] , to extract only-Printable-characters from a file ( any type
    ... So C99 formalises the idea that aform of mainis valid on an ... > implementation documents it as an extension. ... OK I see an argument that the bit from C99 above legitimises ... > void mainand in my book that makes void mainan invalid ...
    (comp.lang.c)