473,322 Members | 1,690 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Hex VS Integer

Out of curiosity, what is the advantage of the following...

opacity = CInt(IIf(pressed, &HCC, &H7F))

Over...

opacity = CInt(IIf(pressed, 204, 127))
Nov 30 '07 #1
2 1072
Charlie Brown wrote:
Out of curiosity, what is the advantage of the following...

opacity = CInt(IIf(pressed, &HCC, &H7F))

Over...

opacity = CInt(IIf(pressed, 204, 127))
Readability, depending on the context - consider the relationship of the
digits to a number written in binary.

I just wish the editor would leave in leading zeros if I type them in.

Andrew
Nov 30 '07 #2
On Nov 30, 11:47 am, "Andrew Morton" <a...@in-press.co.uk.invalid>
wrote:
Charlie Brown wrote:
Out of curiosity, what is the advantage of the following...
opacity = CInt(IIf(pressed, &HCC, &H7F))
Over...
opacity = CInt(IIf(pressed, 204, 127))

Readability, depending on the context - consider the relationship of the
digits to a number written in binary.

I just wish the editor would leave in leading zeros if I type them in.

Andrew
I guess I have always subscribed to naming constants vs magic numbers
in the code.

minOpacity = 127
maxOpacity = 204
opacity = CInt(IIf(pressed, maxOpacity, minOpacity))
Nov 30 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Tony Johansson | last post by:
Hello! I have some problem with STL function remove I have two classes called Handle which is a template class and Integer which is not a template class. The Integer class is just a wrapper...
11
by: nephish | last post by:
Hello there, i need a way to check to see if a certain value can be an integer. I have looked at is int(), but what is comming out is a string that may be an integer. i mean, it will be formatted...
21
by: Frederick Gotham | last post by:
I set about trying to find a portable way to set the value of UCHAR_MAX. At first, I thought the following would work: #define UCHAR_MAX ~( (unsigned char)0 ) However, it didn't work for me....
8
by: Candace | last post by:
I am using the following code to pick off each digit of a number, from right to left. The number I am working with is 84357. So for the first iteration it should return the number 7 and for the...
1
by: charles_gero | last post by:
Hi all, I had a question about the topics in the subject and posted to comp.std.c, but feel it may also be appropriate here. Please excuse this crosspost if it is in bad form. I have a...
7
by: laura | last post by:
Hi, I have a variable of type double. I need to know if there is an integer number store there. How can I test that ? I also have a default precision for doing this operation. Many thanks,...
9
by: jacob navia | last post by:
Hi I am incorporating 128 Bit integer code into lcc-win and it would be nice to have some code to test this feature. Has anyone here code that uses 128 bit integers? Thanks in advance ...
12
by: lithiumcat | last post by:
Hi, I bothered you a while back about storing integer values in void*. Now in a completely unrelated context, I'm trying to store pointer values in an integer type. So the basic question is,...
14
by: Default User | last post by:
Hi, If I have three 64 bit integers and I want to do this operation on them: x*y/z Lets say that what we are multiplying by (y) is offset by what we are dividing by (z) so that the final...
9
by: tsuyois | last post by:
Hi, I just signed in to this excellent network. I hope I could get some answers to many questions I have in writing C compilers. My first question is: Is "integer demotion" required in...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.