Pointer notation 
Author Message
 Pointer notation

Hello,

While maintaining a piece of software this morning I came across some
pointer notation I have never seen before, and I hope somebody can
help me out.  The segment in question is:

        *(TMP+ie)&MASK[i]

TMP is an array with index ie.
MASK is an array of constants.

Has anyone seen something like this before?

Thanks
KS



Sat, 03 Jul 2004 00:05:50 GMT  
 Pointer notation

Quote:

> While maintaining a piece of software this morning I came across some
> pointer notation I have never seen before,

No, you didn't :-).

Quote:
>    *(TMP+ie)&MASK[i]

> TMP is an array with index ie.
> MASK is an array of constants.

> Has anyone seen something like this before?

Yes, but it is simpler than you think it is. Unary * binds more closely
than binary &, so this parses as:

  (*(TMP+ie)) & (MASK[i])

That is, the pointer isn't bit-anded with the mask, the result of
dereferencing that pointer is. It would be equivalent to this:

  TMP[ie] & MASK[i]

Richard



Fri, 02 Jul 2004 23:36:54 GMT  
 Pointer notation


Quote:
>Hello,

>While maintaining a piece of software this morning I came across some
>pointer notation I have never seen before, and I hope somebody can
>help me out.  The segment in question is:

>    *(TMP+ie)&MASK[i]

This expression bitwise ANDs the value stored in MASK[i] and the value
stored in TMP[ie] (aka *(TMP+ie) )

Quote:
>TMP is an array with index ie.
>MASK is an array of constants.

>Has anyone seen something like this before?

>Thanks
>KS

Lew Pitcher, Information Technology Consultant, Toronto Dominion Bank Financial Group

(Opinions expressed are my own, not my employer's.)



Sat, 03 Jul 2004 00:12:40 GMT  
 Pointer notation


Quote:
> Hello,

> While maintaining a piece of software this morning I came across some
> pointer notation I have never seen before, and I hope somebody can
> help me out.  The segment in question is:

>      *(TMP+ie)&MASK[i]

Ah the power of spaces and array notation...

... TMP[ie] & MASK[i] ...

Where's the rest of the line? It would have helped.

--
- Mark A. Odell
- Embedded Firmware Design, Inc.
- http://www.embeddedfw.com



Sat, 03 Jul 2004 00:26:48 GMT  
 Pointer notation
sdfsdf
Quote:
> Hello,

> While maintaining a piece of software this morning I came across some
> pointer notation I have never seen before, and I hope somebody can help
> me out.  The segment in question is:

>    *(TMP+ie)&MASK[i]

> TMP is an array with index ie.
> MASK is an array of constants.

> Has anyone seen something like this before?

> Thanks
> KS



Sat, 03 Jul 2004 15:43:38 GMT  
 Pointer notation

Quote:



> >Hello,

> >While maintaining a piece of software this morning I came across some
> >pointer notation I have never seen before, and I hope somebody can
> >help me out.  The segment in question is:

> >       *(TMP+ie)&MASK[i]

> This expression bitwise ANDs the value stored in MASK[i] and the value
> stored in TMP[ie] (aka *(TMP+ie) )

> >TMP is an array with index ie.
> >MASK is an array of constants.

> >Has anyone seen something like this before?

> >Thanks
> >KS

> Lew Pitcher, Information Technology Consultant, Toronto Dominion Bank Financial Group

> (Opinions expressed are my own, not my employer's.)

hei,i love your humor!i never thought a programmer has such
humor!though i learn for many times to be a humorous man but failed as
well as to be a programmer! in fact,i am a beginer.


Sat, 03 Jul 2004 21:32:04 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Please Please Help! - pointer notation

2. Help - pointer notation please...

3. Pointer Notation Flaw

4. subscript notation with pointer to pointer fails

5. Validity of simplified notation for calling functions from function pointers

6. Dereferencing f-pointers, arrays of f-pointers, pointers to f-pointers

7. "e" notation as opposed to "E" notation, question

8. typed and untyped notation

9. ILDASM method signature notation

10. Moving C code from K&R to ANSI notation

11. ILDASM method signature notation

12. Hungarian Notation Can be Considered Harmful (was Re: GCC/G++ vs Other guys)

 

 
Powered by phpBB® Forum Software