473,394 Members | 1,902 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,394 software developers and data experts.

__unaligned before and after the * (64bit)

Udi
Hi All,
I'm not sure I understand the difference between placing the
__unaligned before or after the *:
I was trying to handle the C4366 warning - "The result of the unary
'&' operator may be unaligned") and used the '__unaligned' modifier as
suggested,
but ended up with C4090 - "different '__unaligned' qualifiers". (See
below)
However, moving the __unaligned keyword after the ' * '
solved the warning but I'm not sure I solved the probelm.
with no __unaligned keyword --Warning C4366
`````````````````````````````````````````````````` `````````````````````
void List_Clear(List *pList) ;
:
List * pSubscribersList = NULL;

pSubscribersList = (List *)&(p->subscribersList); //C4366: The result
of the unary '&' operator may be unaligned
List_Clear(pSubscribersList);


__unaligned before the * --warning C4090
`````````````````````````````````````````````````` `````````````
void List_Clear(List *pList) ;
:
List __unaligned * pSubscribersList = NULL;

pSubscribersList = (List __unaligned *)&(p->subscribersList);
List_Clear(pSubscribersList); //warning C4090: 'function' : different
'__unaligned' qualifiers
__unaligned after the * --no warnings
`````````````````````````````````````````````````` ``````
void List_Clear(List *pList) ;
:
List * __unaligned pSubscribersList = NULL;

pSubscribersList = (List * __unaligned)&(p->subscribersList);
List_Clear(pSubscribersList); // OK - no warning

Can anyone explain what's the difference between the last two
examples?
I'm using VS2005 compiling to 64 bit.
Thanks!
Mar 19 '08 #1
3 6437
On 19 Mar, 08:53, Udi <UdiBenSen...@gmail.comwrote:
I'm not sure I understand the difference between placing the
__unaligned before or after the *:
<snip>
I'm using VS2005 compiling to 64 bit.
__unaligned isn't part of standard C. You needd to ask ona compler
specific news group. Try I Microsoft related ng.
--
Nick Keighley
Mar 19 '08 #2
Nick Keighley <ni******************@hotmail.comwrites:
On 19 Mar, 08:53, Udi <UdiBenSen...@gmail.comwrote:
>I'm not sure I understand the difference between placing the
__unaligned before or after the *:

<snip>
>I'm using VS2005 compiling to 64 bit.

__unaligned isn't part of standard C. You needd to ask ona compler
specific news group. Try I Microsoft related ng.
Better yet, re-write the code to avoid the need to use __unaligned.
The original poster appears to be writing code for a linked list.
There's no need to use any implementation-specific extensions for such
a relatively straightforward task.

Apparently the compiler's warning "The result of the unary '&'
operator may be unaligned" included a suggestion to use __unaligned.
I strongly suspect that suggestion was a poor one.

--
Keith Thompson (The_Other_Keith) <ks***@mib.org>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Mar 19 '08 #3
Udi wrote:
I'm not sure I understand the difference between placing the
__unaligned before or after the *:
I guess, it works like 'const', which applies to the left unless it is at
the leftmost side, then it applies to the right. However, it is, as others
pointed out, non-standard, so you have to consult the compiler docs.
I was trying to handle the C4366 warning - "The result of the unary
'&' operator may be unaligned") and used the '__unaligned' modifier as
suggested, but ended up with C4090 - "different '__unaligned' qualifiers".
(See below)
However, moving the __unaligned keyword after the ' * '
solved the warning but I'm not sure I solved the probelm.
I don't think so...
>
void List_Clear(List *pList) ;
:
List * pSubscribersList = NULL;

pSubscribersList = (List *)&(p->subscribersList); //C4366: The result
of the unary '&' operator may be unaligned
Well, the first problem here is that you are using casts, which is typically
a sign that something's wrong. Remove those, and you won't need any
unaligned attributes. If it doesn't compile then, your types simply don't
match, but adding them doesn't change that. If you can't do it yourself or
want to verify the solution is correct, please boil your problem down to a
minimal but complete example, in particular guessing
what 'p->subscribersList' could be is pretty hart.

Uli

Mar 19 '08 #4

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

Similar topics

3
by: Christian McArdle | last post by:
REQUEST FOR DISCUSSION (RFD) unmoderated group comp.os.ms-windows.programmer.64bit This is a formal Request For Discussion (RFD) to create comp.os.ms-windows.programmer.64bit as an unmoderated...
11
by: Vijay Chegu | last post by:
I have built a 64bit ATL COM dll. When i register the dll on IA64 windows Enterprise server 2003, i get following error. DllRegisterServer in mydll.dll failed. Return code was : 0x80020009 ...
3
by: Frank Uray | last post by:
Hi all I have written a WindowsService in C# 2005. I am running this service on a 64bit Windows Server 2003 and I like to run some Interop.Excel within this service. It seams that Interop...
4
by: mike | last post by:
I have found that orig tested 64 bit on our 64bit windows 2003 server...about 1 year ago...and company decided to use sql 32 bit on the 64bit os my question and any information is very welcome ...
1
by: GaryDean | last post by:
We have been developing all of our .net applications on 32 bit windows using 32 bit SQL Server. We are being asked to now deploy to servers running 64bit windows and 64bit SQL Server. Are there...
2
by: M O J O | last post by:
(I'm using Visual Studio 2008) I want my new develloper pc to be Vista 64bit, but all my clients are so far 32bit (XP), so my questions are: 1) Is it possible for me to tell VS2008 that the...
5
by: Neetu | last post by:
Hi Everybody, Our reports works well on every machine but not on 64bit systems. We can view the report but when we press print button it does nothing, it just stay there and prompt nothing, even...
4
by: Zorro | last post by:
Hello every one. Please see if you can help. The question is not about packing and alignment. It is about the use of qualifier __unaligned on double indirection. The line "(*((something**)...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
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...
0
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...
0
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...

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.