hi all,
in http://www.c-faq.com/cpp/ifendian.html
it is said that integer formats used in pre processor #if expressions
are
not the same as those will be used at run time.
can any one explain about this difference in formats??? 8 2058 aa*****@gmail.c om said: hi all,
in http://www.c-faq.com/cpp/ifendian.html
it is said that integer formats used in pre processor #if expressions are not the same as those will be used at run time.
What it actually says is: "At any rate, the integer formats used in
preprocessor #if expressions are not necessarily the same as those that
will be used at run time."
Note the phrase 'not necessarily'.
can any one explain about this difference in formats???
Consider, for example, the case of a cross-compiler, which runs on a
big-endian machine but which compiles code for use on a little-endian
machine. The preprocessor will of course run on the big-endian box (in this
example), so it will use big-endian integers - but the object code will be
executed on the little-endian machine (in this example), so it will use
little-endian integers.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999 http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Richard Heathfield wrote: aa*****@gmail.c om said: hi all,
in http://www.c-faq.com/cpp/ifendian.html
it is said that integer formats used in pre processor #if expressions are not the same as those will be used at run time.
What it actually says is: "At any rate, the integer formats used in preprocessor #if expressions are not necessarily the same as those that will be used at run time."
Note the phrase 'not necessarily'.
can any one explain about this difference in formats???
Consider, for example, the case of a cross-compiler, which runs on a big-endian machine but which compiles code for use on a little-endian machine. The preprocessor will of course run on the big-endian box (in this example), so it will use big-endian integers - but the object code will be executed on the little-endian machine (in this example), so it will use little-endian integers.
Endianness and host v target issues are all but irrelevant to the
preprocessor
since it deals with values, not objects!
The FAQ's use of the word 'Format' is perhaps misleading. The real
issue
is that the preprocessor performs calculations using only the largest
integer
type(s). Thus, the preprocessor doesn't always evaluate expressions in
the
same way that the same expression would be evaluated in later
translation
phases...
% type ppm1.c
#include <stdio.h>
int main(void)
{
if (-1 == 4294967295)
{
puts("test 1");
}
#if (-1 == 4294967295)
puts("test 2");
#endif
return 0;
}
% acc ppm1.c -o ppm1.exe
ppm1.c: In function `main':
ppm1.c:5: warning: this decimal constant is unsigned only in ISO C90
ppm1.c:5: warning: comparison between signed and unsigned
% ppm1.exe
test 1
%
By rights, this program should either produce both "test 1" and "test
2", or
neither. However, because the preprocessor uses different 'arithmetic'
to
evaluate expressions, my implementation produced only one output line,
even though the two tests were identical.
--
Peter
Peter Nilsson said: Endianness and host v target issues are all but irrelevant to the preprocessor since it deals with values, not objects!
Um, quite so - but if it /did/ deal with objects, my answer would have
looked pretty good. :-)
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999 http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
does this mean that pre processor uses only signed long data type
only???? aa*****@gmail.c om wrote: does this mean that pre processor uses only signed long data type only????
Click on 'More Options' and 'Add Reply' to quote context. No one knows
what you're saying. The last message in this thread was Richard
Heathfield talking about one of his previous posts.
Richard Heathfield <in*****@invali d.invalid> writes: aa*****@gmail.c om said:
hi all,
in http://www.c-faq.com/cpp/ifendian.html
it is said that integer formats used in pre processor #if expressions are not the same as those will be used at run time.
What it actually says is: "At any rate, the integer formats used in preprocessor #if expressions are not necessarily the same as those that will be used at run time."
Note the phrase 'not necessarily'.
can any one explain about this difference in formats???
Consider, for example, the case of a cross-compiler, which runs on a big-endian machine but which compiles code for use on a little-endian machine. The preprocessor will of course run on the big-endian box (in this example), so it will use big-endian integers - but the object code will be executed on the little-endian machine (in this example), so it will use little-endian integers.
I fail to see how endian issues are a concern of a preprocessor.
Richard G. Riley said: Richard Heathfield <in*****@invali d.invalid> writes:
Consider, for example, the case of a cross-compiler, which runs on a big-endian machine but which compiles code for use on a little-endian machine. The preprocessor will of course run on the big-endian box (in this example), so it will use big-endian integers - but the object code will be executed on the little-endian machine (in this example), so it will use little-endian integers.
I fail to see how endian issues are a concern of a preprocessor.
Well, if they *were*, then my answer would make sense.
Likewise, if red were a giraffe, roses would have better camouflage.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999 http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Richard Heathfield <in*****@invali d.invalid> writes: Richard G. Riley said:
Richard Heathfield <in*****@invali d.invalid> writes:
Consider, for example, the case of a cross-compiler, which runs on a big-endian machine but which compiles code for use on a little-endian machine. The preprocessor will of course run on the big-endian box (in this example), so it will use big-endian integers - but the object code will be executed on the little-endian machine (in this example), so it will use little-endian integers.
I fail to see how endian issues are a concern of a preprocessor.
Well, if they *were*, then my answer would make sense.
Likewise, if red were a giraffe, roses would have better camouflage.
Why would Roses want to have better camouflage? And I know a giraffe
called Red (well, "big red" to be precise). So from this I deduce that
Roses have better camouflage : but better than what I'm not sure. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Richard Hollenbeck |
last post by:
I'm trying to write some code that will convert any of the most popular
standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan
1908) and compare the first with the second and calculate days, months, and
years. This is not for a college course. It's for my own personal
genealogy website. I'm stumped about the code. I'm working on it but not
making much progress. Is there any free code available anywhere? I know it...
|
by: Subodh |
last post by:
Hi,
Currently we get data from more then 200 different sources and all of
our vendors provide data in different file formats. The problem is we
have more then 100 DTS packages now and the maintainance is very
diffucult.
Every time our vendor changes the format we have to change in multiple
DTS packages.
Is anybody know what would be the right way of reducing the no. of DTS
packages.
|
by: REH |
last post by:
If the is_modulo field of the numeric_limits class is true for signed
integer types, can I assume that overflow for such types is defined
behavior? If so, is the behavior the same regardless of
implementation?
Also, if the range of an integer type is not symmetrical around zero
(i.e., 2's comp.), is it safe to assume that the extra value(s) is one
the negative side?
Thanks,
|
by: shanx__=|;- |
last post by:
hi i need some help regarding use of very very long integer datatype
in 'c'.. i need it to store result of large number's factorial..
if someone can healp it would be a delight..
|
by: Mark Jerde |
last post by:
(If these are the wrong groups please suggest the right one(s). Thanks.)
I need to come up with a way to test potentially thousands of data (files /
records / streams) to determine if they match one of about thirty defined
data formats. If a record partially matches one of the formats I need to
log why it failed.
The formats are byte-oriented. Byte 0 is the type, byte 1 is the subtype,
bytes 2-5 give the total record length, etc. ...
| |
by: Steven T. Hatton |
last post by:
http://public.research.att.com/~bs/bs_faq2.html#int-to-string
Is there no C library function that will take an int and convert it to its
ascii representation? The example Bjarne shows in his faq is not extremely
convenient.
--
NOUN:1. Money or property bequeathed to another by will. 2. Something handed
down from an ancestor or a predecessor or from the past: a legacy of
religious freedom. ETYMOLOGY: MidE legacie, office of a deputy,...
|
by: Peter Oliphant |
last post by:
The Image class allows loading a bitmap from a graphic file. So far I've
gotten it to work with JPG and BMP files.
What other graphic file formats are supported in this way? Is this fixed
based on the .NET Framework used (e.g., the Image class defines which
formats can be used), or can different file formats be added after-the-fact
(end-user capability in contrast to developer implementation)?
Also, is it possible to save an image in...
|
by: rembremading |
last post by:
Hi all!
The following piece of code has (for me) completely unexpected behaviour.
(I compile it with gcc-Version 4.0.3)
Something goes wrong with the integer to float conversion.
Maybe somebody out there understands what happens.
Essentially, when I subtract the (double) function value GRID_POINT(2) from
a variable which has been assigned the same value before this gives a
non-zero result and I really do not understand why.
|
by: john.goodleaf |
last post by:
I'm poking at writing data out to a SAS XPORT file (transport file).
Each record must be 80 bytes long, ASCII. Integers should be "IBM-
style integers" and floats should be "IBM-style doubles." Now I have
some idea what that means from reading a C source file documented by
the SAS institute, but before I go over the deep end trying to write
my own routines, does anyone know of an already-done means of writing
integers and floats out to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
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...
|
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...
|
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...
|
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...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |