Re: Where do pointers point to?
From: x-pander (ngclc_at_pitek.eu.org)
Date: 01/12/05
- Next message: E. Robert Tisdale: "Re: Parse "Card * const wDeck""
- Previous message: Eric Sosman: "Re: Where do pointers point to?"
- In reply to: Eric Sosman: "Re: Where do pointers point to?"
- Next in thread: Eric Sosman: "Re: Where do pointers point to?"
- Reply: Eric Sosman: "Re: Where do pointers point to?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 12 Jan 2005 21:50:59 +0100
>> void memset2(void *p, int c, int n)
>> {
>> while(n-->0) *((char *)p)++ = c;
>> }
>
> When my compiler considered this, it said
>
> "foo.c", line 4: warning: a cast does not
> yield an lvalue
>
yea, my bad, but that was not what the question was all about
let me change the implemetation to:
void memset2(void *p, int c, int n)
{
while(n-->0) ((char *)p)[n] = c;
}
now it should be valid and the original question remains unchanged
- Next message: E. Robert Tisdale: "Re: Parse "Card * const wDeck""
- Previous message: Eric Sosman: "Re: Where do pointers point to?"
- In reply to: Eric Sosman: "Re: Where do pointers point to?"
- Next in thread: Eric Sosman: "Re: Where do pointers point to?"
- Reply: Eric Sosman: "Re: Where do pointers point to?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|