473,804 Members | 3,163 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

what is 0xFFFFFFF ?

in a program it is passing like that:

#define INFINITY 0xFFFFFFF

it is a ASCII code of what? or is it a address that a pointer hold?
so adress of what?

Jan 24 '07
30 39478
David T. Ashley wrote:
>

My arguments about complication come from some of the prohibitions on "magic
numbers". I've been blasted all the time for code like:

if (x 87192) /* Number of hairs a cat might have. */
{

My counter-argument is that the only time it makes sense to define something
as a preprocessor constant is if:
Why a preprocessor constant?

Why not

const unsigned number_of_hairs _a_cat_might_ha ve = 87192;
>
Some of the code I've seen in my time has made a lot of work for me. For
example, I've seen stuff like:

if (x UINT8_TWO)
{

If I'm going after a nebulous bug, it means that every time I see something
like that I have to verify the symbol the preprocessor is using. It is
unnecessary work.
Again, if it where an integer constant, your debugger or whatever would
be able to show you the value. Preprocessor constants are evil.

--
Ian Collins.
Jan 24 '07 #21
Ian Collins <ia******@hotma il.comwrites:
David T. Ashley wrote:


My arguments about complication come from some of the prohibitions
on "magic numbers". I've been blasted all the time for code like:

if (x 87192) /* Number of hairs a cat might have. */
{

My counter-argument is that the only time it makes sense to define
something as a preprocessor constant is if:
Why a preprocessor constant?

Why not

const unsigned number_of_hairs _a_cat_might_ha ve = 87192;
Because an object declared as const can't be used in some contexts
where an appropriately defined macro can. For example, your
number_of_hairs _a_cat_might_ha ve can't be used as a case label:

switch(whatever ) {
case number_of_hairs _a_cat_might_ha ve: /* error */
...
}

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Jan 24 '07 #22
Keith Thompson wrote:
Ian Collins <ia******@hotma il.comwrites:
>>David T. Ashley wrote:
>>>
My arguments about complication come from some of the prohibitions
on "magic numbers". I've been blasted all the time for code like:

if (x 87192) /* Number of hairs a cat might have. */
{

My counter-argument is that the only time it makes sense to define
something as a preprocessor constant is if:

Why a preprocessor constant?

Why not

const unsigned number_of_hairs _a_cat_might_ha ve = 87192;


Because an object declared as const can't be used in some contexts
where an appropriately defined macro can. For example, your
number_of_hairs _a_cat_might_ha ve can't be used as a case label:

switch(whatever ) {
case number_of_hairs _a_cat_might_ha ve: /* error */
...
}
I know, but it was appropriate in the context of this example.

--
Ian Collins.
Jan 24 '07 #23


On Jan 24, 3:15 pm, Keith Thompson <k...@mib.orgwr ote:
"Lew Pitcher" <lpitc...@sympa tico.cawrites:[...]
0xFFFFFFF is taken as an integer value
It /might/ be used as the initializer for a pointer
It /might/ be used as the initializer for an integer data item
It depends on the context
0xFFFFFFF cannot be used as the initializer for a pointer unless it's
explicitly converted. There is no implicit integer-to-pointer
conversion except for the special case of null pointer constants.
Note that I didn't say that it could /legally/ be used as an
initializer for a pointer.

Since the OP didn't present any code other than the #define, we (I)
have no way of knowing what the code that uses the macro looks like.
Conceivable, the code could contain
char *somewhere = (char *)INFINITY;
in which case, the code /would/ be using the macro as an initializer
for a pointer. Wrongly.

I /did/ say that what the macro was used for (and hence, the
replacement token, the 0xFFFFFFF) depended on the source code.

--
Lew

Jan 25 '07 #24
In article <11************ **********@v45g 2000cwv.googleg roups.com>,
Lew Pitcher <lp******@sympa tico.cawrote:
>Since the OP didn't present any code other than the #define, we (I)
have no way of knowing what the code that uses the macro looks like.
Except for common sense.

-- Richard
--
"Considerat ion shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Jan 25 '07 #25
Ian Collins wrote:
>
.... snip ...
>
Why a preprocessor constant?

Why not

const unsigned number_of_hairs _a_cat_might_ha ve = 87192;
This is a serious misnomer. It should be:

const unsigned number_of_hairs _my_cat_shed_to day = 87192;

--
<http://www.cs.auckland .ac.nz/~pgut001/pubs/vista_cost.txt>

"A man who is right every time is not likely to do very much."
-- Francis Crick, co-discover of DNA
"There is nothing more amazing than stupidity in action."
-- Thomas Matthews
Jan 25 '07 #26
Richard Tobin wrote:
In article <11************ **********@v45g 2000cwv.googleg roups.com>,
Lew Pitcher <lp******@sympa tico.cawrote:
>Since the OP didn't present any code other than the #define, we (I)
have no way of knowing what the code that uses the macro looks like.

Except for common sense.
Real code:

#define G_WIN32_MSG_HAN DLE 19981206

"HANDLE" there means "Windows HANDLE thing", a pointer.

Regards,
Yevgen
Jan 25 '07 #27
Yevgen Muntyan <mu************ ****@tamu.eduwr ites:
Richard Tobin wrote:
In article <11************ **********@v45g 2000cwv.googleg roups.com>,
Lew Pitcher <lp******@sympa tico.cawrote:
Since the OP didn't present any code other than the #define, we (I)
have no way of knowing what the code that uses the macro looks like.
Except for common sense.

Real code:

#define G_WIN32_MSG_HAN DLE 19981206

"HANDLE" there means "Windows HANDLE thing", a pointer.
The value 19981206 looks suspiciously like a date (December 6, 1998);
I doubt that that value would make sense as a pointer in Win32.

Um, what was your point?

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Jan 25 '07 #28
At about the time of 1/24/2007 6:54 AM, Harald van Dijk stated the following:
iskeletor wrote:
>in a program it is passing like that:

#define INFINITY 0xFFFFFFF

it is a ASCII code of what? or is it a address that a pointer hold?
so adress of what?

0xFFFFFFFF is a hexadecimal integer constant. Its decimal value is
simply 4294967295. As far as C is concerned, that does not mean
infinity. Applications, however, may choose to have it mean exactly
that, just as they may choose 2 to mean infinity.

I don't know if you know what hexadecimal means. If you don't, a quick
search gives me
http://www.pcnineoneone.com/howto/hex1.html
as one possible introduction.
Actually, it would be 268,435,455 as there are only 7 hex digits in that
declaration. It would be positive no matter signed or unsigned on a
32-bit platform because it's only 28 bits.

--
Daniel Rudy

Email address has been base64 encoded to reduce spam
Decode email address using b64decode or uudecode -m

Why geeks like computers: look chat date touch grep make unzip
strip view finger mount fcsk more fcsk yes spray umount sleep
Jan 25 '07 #29
Keith Thompson wrote:
Yevgen Muntyan <mu************ ****@tamu.eduwr ites:
>Richard Tobin wrote:
>>In article <11************ **********@v45g 2000cwv.googleg roups.com>,
Lew Pitcher <lp******@sympa tico.cawrote:

Since the OP didn't present any code other than the #define, we (I)
have no way of knowing what the code that uses the macro looks like.
Except for common sense.
Real code:

#define G_WIN32_MSG_HAN DLE 19981206

"HANDLE" there means "Windows HANDLE thing", a pointer.

The value 19981206 looks suspiciously like a date (December 6, 1998);
I doubt that that value would make sense as a pointer in Win32.

Um, what was your point?
Does common sense tell you that G_WIN32_MSG_HAN DLE is a pointer (namely
is to be used as a pointer)? Where it's used, pointers are in fact cast
to int, and then back to pointers, so int here makes perfect sense in
fact. But can you tell this just looking at the #define?

As to values which do or don't make sense as pointers, why should it
be a valid pointer? These guys are nice too: (Whatever*)1 or
(Whatever*)-1. Their sense exactly is that they aren't valid pointers
(on conventional implementations , blah blah blah).
Jan 25 '07 #30

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

Similar topics

2
3112
by: thecrow | last post by:
Alright, what the hell is going on here? In the following code, I expect the printed result to be: DEBUG: frank's last name is burns. Instead, what I get is: DEBUG: frank's last name is burns. Here is the code: $frank = "burns";
220
19190
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have any preconceived ideas about it. I have noticed, however, that every programmer I talk to who's aware of Python is also talking about Ruby. So it seems that Ruby has the potential to compete with and displace Python. I'm curious on what basis it...
699
34279
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro capabilities, unfortunately. I'd like to know if it may be possible to add a powerful macro system to Python, while keeping its amazing syntax, and if it could be possible to add Pythonistic syntax to Lisp or Scheme, while keeping all of the...
92
6550
by: Reed L. O'Brien | last post by:
I see rotor was removed for 2.4 and the docs say use an AES module provided separately... Is there a standard module that works alike or an AES module that works alike but with better encryption? cheers, reed
137
7206
by: Philippe C. Martin | last post by:
I apologize in advance for launching this post but I might get enlightment somehow (PS: I am _very_ agnostic ;-). - 1) I do not consider my intelligence/education above average - 2) I am very pragmatic - 3) I usually move forward when I get the gut feeling I am correct - 4) Most likely because of 1), I usually do not manage to fully explain 3) when it comes true. - 5) I have developed for many years (>18) in many different environments,...
12
11191
by: Dario | last post by:
The following simple program behaves differently in Windows and Linux . #include <stdexcept> #include <iostream> #include <string> using namespace std; class LogicError : public logic_error { public: string desc;
0
10338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10323
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10082
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7622
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6856
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2997
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.