Curry
  • Curry
What does the following way of defining a variable mean? #define COUNT ((long) (sizeof(long) <<1))
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
jamiebookeater
  • jamiebookeater
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
it's a macro that defines COUNT as the size of a long shifted one bit to the left sizeof(long) = 4 0100 moved one bit to the left 1000 or 8
Curry
  • Curry
so how do i write macros?
Curry
  • Curry
like what defines it, how would i write another one if I wanted to? and why not just use a 8 byte variable type.

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

Curry
  • Curry
And how exactly would I use the macro? esp seince it's called a function.
anonymous
  • anonymous
this one is a variable. macros can also be functions though ``` //taken from http://stackoverflow.com/a/3437442/2761134 #define MAX(a,b) ((a) > (b) ? a : b) #define MIN(a,b) ((a) < (b) ? a : b) ```
e.mccormick
  • e.mccormick
https://gcc.gnu.org/onlinedocs/cpp/Macros.html
anonymous
  • anonymous
Macros are executed by the preprocessor, and they only ever do text replacement. ``` #define MAX(a,b) ((a) > (b) ? a : b) int f() { return MAX(2, 4); } ``` Putting this through the preprocessor will get you something like: ``` int f() { return ((2) > (4) ? 2 : 4); } ``` Which will then later on be compiled. So obviously your macros should only do really simple things. Other languages don't even have this feature, because some consider it dangerous.

Looking for something else?

Not the answer you are looking for? Search for more explanations.