473,666 Members | 2,107 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

cast odd boundary?

Hi

I have read somwhere that this problem is handled by the
Intel cpu's (firmware), but what will happen on other types of cpu's.

struct
{
char aa; // even boundary 0xaa00
char bb[4]; // assume on odd boundary 0xaa01
} mstr;

long ll;
ll = *((long*)mstr.b b); // no: 1 do i get an exception?

*((long*)mstr.b b) = ll; // no: 2 do i get an exception?

/dev

Nov 14 '05 #1
1 1442
In article <40********@new s1e1.seinf.abb. se>,
"Devrobcom" <de*******@hotm ail.com> wrote:
Hi

I have read somwhere that this problem is handled by the
Intel cpu's (firmware), but what will happen on other types of cpu's.

struct
{
char aa; // even boundary 0xaa00
char bb[4]; // assume on odd boundary 0xaa01
} mstr;
Assuming that that is the case (i.e. there is no padding between aa
and bb, and sizeof(long) == 4).

long ll;
ll = *((long*)mstr.b b); // no: 1 do i get an exception?
You could get an exception, or you app could simply crash, or monkeys
could spring forth from your gut :), as that is undefined behavior. Many
platforms require special alignment for particular types.
*((long*)mstr.b b) = ll; // no: 2 do i get an exception?


Same answer

Nov 14 '05 #2

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

Similar topics

1
1754
by: Daniele Varrazzo | last post by:
Hi everybody, i'm experiencing crashing of the apache process when a mod_python handler access the properties "boundary" and "allowed_xmethods" of the request argument. This prevents the use of some interactive remote debuggers (such ActiveState's) that try to read the contents of the variables in the namespace and graphically present them in tree form. I reported the crash on win32 platform. I am using python 2.3.4, apache 2.0.47,...
14
19154
by: Singleton | last post by:
Can some one guide me what is word boundary? google is no good for me for this thanks in advance
11
3771
by: Taran | last post by:
Hi all, I was wondering how does address alignment to x byte boundary is done. For example, if I say "adjust the requested size to be on a 4-byte boundary" or for that matter 8 byte boundary. How is this adjustment/alignment done? I goolged around alot and wans't able to find how is it done, all it said was what is byte alignment and byte padding.
2
9913
by: szabi | last post by:
Hi! I have seen in a couple of libraries that object are never passed through dll boundary, instead the results are returned through an output parameter reference like: void f(std::string &s) { s = "foo"; }
3
1404
by: Tao | last post by:
hi. guys, I have two AppDomains, AppDomain0 and AppDomain1. In AppDomain1, I got a class implements an interface IInterface0. In AppDomain0, I also define a IInterface0, the code of two interfaces are exactly same. When I call: appDomain.CreateInstanceFromAndUnwrap and try to convert to AppDomain0.IInterface0. I got an error.
29
2814
by: K. Jennings | last post by:
I would like to get the result of malloc() such that it is aligned on a given boundary - 8, in this case. Assuming that sizeof(u64) is 8, will u64 *p = malloc(N) ; do the trick in general? Here N is a positive integer, and I am assuming that malloc() succeeds in allocating the chunk of memory specified.
3
1767
by: Boki | last post by:
Hi All, I saw my code jump out the function call directly without throw a boundary error.... no boundary check ? string str_member_id = new string;
2
2545
by: kgeorge2 | last post by:
A library which i use, has an array class class LibArray { public: LibArray():_array(NULL),_len(0); LibArray(int n, float val):_array( new float),_len(n){} /** more complete definition omitted
6
1992
by: Gernot Frisch | last post by:
Hi, the program below workes w/o problems on a GP2X and on the PC, but my PocketPC (using GCC 3.3.3) crashes. Very dissapointing, since I expect some speed boost from it. Thnak you for your help. int dx=..; // number of pixels width to draw // one pixel is one unsigned short
0
8871
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8552
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
8640
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...
1
6198
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
5666
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
4198
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
2773
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
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
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.