In college, we used to challenge eachother. We'd give eachother blocks of
really really obscure C code and see if the other person could figure out
what it does without running it. The author of this bit of code must have
attended my school :-)
The pipes are bitwise OR. The << operator is a logical left shift. In C,
placing a character between single quotes is the same as getting the numeric
value of the character. see
http://www.asciitable.com/
So, this expression is simply an integer value created using a series of
rather obtuse binary expressions.
public const int LOCSIG = 'P' | ('K' << 8) | (3 <<16) | (4 << 24)
which is equal to 0000 0100 0000 0011 0100 1001 0101 0000
or hex 0403 4B50
HTH,
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik
Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Matthew Hood" <Dr***********@Yahoo.com> wrote in message
news:OZ**************@TK2MSFTNGP12.phx.gbl... I'm playing around with converting some C# code to VB.NET as a learning
exercise and I'm running into a little confussion for my lack of
understanding some C# syntax.
The C# code is:
public const int LOCSIG = 'P' | ('K' << 8) | (3 <<16) | (4 << 24)
Can anybody explain to me what this is doing and possibly give me a VB.NET
equivalent?
I'm confused about the characters 'P' & 'K' as part of an integer constant
and what the pipes are along with what << means.
TIA,
-Matt