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

structure paddind

how to stop or change structure padding ???
Mar 5 '08 #1
5 1439
amit wrote:
how to stop or change structure padding ???
(a) See your local implementation manual for the implementation-specific
way to do this.

(b, preferred if plausible) Write your code so that it doesn't care about
structure padding even if there is any.

Why do you think you want to stop or change structure padding?

--
"Well begun is half done." - Proverb

Hewlett-Packard Limited Cain Road, Bracknell, registered no:
registered office: Berks RG12 1HN 690597 England

Mar 5 '08 #2
Chris Dollin wrote:
amit wrote:
>how to stop or change structure padding ???

(a) See your local implementation manual for the implementation-specific
way to do this.

(b, preferred if plausible) Write your code so that it doesn't care about
structure padding even if there is any.

Why do you think you want to stop or change structure padding?
We had a discussion about the

#pragma pack

construct in this group several weeks ago. Google for it, since
we gave a detailed discussion about that construct in many different
situations and compilers

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Mar 5 '08 #3
jacob navia wrote:
Chris Dollin wrote:
>amit wrote:
>>how to stop or change structure padding ???

(a) See your local implementation manual for the
implementation-specific way to do this.

(b, preferred if plausible) Write your code so that it doesn't
care about structure padding even if there is any.

Why do you think you want to stop or change structure padding?

We had a discussion about the #pragma pack construct in this
group several weeks ago. Google for it, since we gave a detailed
discussion about that construct in many different situations and
compilers
Once more, Jacob is off-topic and not portable. See the following
extract from N869:

6.10.6 Pragma directive

Semantics

[#1] A preprocessing directive of the form

# pragma pp-tokens-opt new-line

where the preprocessing token STDC does not immediately
follow pragma in the directive (prior to any macro
replacement)136) causes the implementation to behave in an
implementation-defined manner. The behavior might cause
translation to fail or cause the translator or the resulting
program to behave in a non-conforming manner. Any such
pragma that is not recognized by the implementation is
ignored.

____________________

136An implementation is not required to perform macro
replacement in pragmas, but it is permitted except for in
standard pragmas (where STDC immediately follows pragma).
If the result of macro replacement in a non-standard
pragma has the same form as a standard pragma, the
behavior is still implementation-defined; an
implementation is permitted to behave as if it were the
standard pragma, but is not required to.
[#2] If the preprocessing token STDC does immediately follow
pragma in the directive (prior to any macro replacement),
then no macro replacement is performed on the directive, and
the directive shall have one of the following forms whose
meanings are described elsewhere:

#pragma STDC FP_CONTRACT on-off-switch
#pragma STDC FENV_ACCESS on-off-switch
#pragma STDC CX_LIMITED_RANGE on-off-switch

on-off-switch: one of
ON OFF DEFAULT

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
--
Posted via a free Usenet account from http://www.teranews.com

Mar 5 '08 #4
In article <87************@kvetch.smov.org>,
Keith Thompson <ks***@mib.orgwrote:
>Using #pragma pack might turn out to be the perfect solution to the
OP's problem, but recommending it without even mentioning the caveats
is irresponsible.
He pointed the poster to a previous discussion of it. Does he have
to repeat it all too?

-- Richard
--
:wq
Mar 5 '08 #5
Richard Tobin wrote:
In article <87************@kvetch.smov.org>,
Keith Thompson <ks***@mib.orgwrote:
>Using #pragma pack might turn out to be the perfect solution to the
OP's problem, but recommending it without even mentioning the caveats
is irresponsible.

He pointed the poster to a previous discussion of it. Does he have
to repeat it all too?

-- Richard
It was a deep discussion with pros, cons, examples
from weird architectures, etc. I did not recommend anything
I just pointed to that discussion, as you say.

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Mar 5 '08 #6

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

Similar topics

2
by: vikas | last post by:
I have following structure in c++. typedef struct MMF_result_struct { int action; char text; int cols,rows; int month,day,year; } MMF_result; Now this structure is shared between C++ and C#...
26
by: Brett | last post by:
I have created a structure with five fields. I then create an array of this type of structure and place the structure into an array element. Say index one. I want to assign a value to field3 of...
4
by: marco_segurini | last post by:
Hi, From my VB program I call a C++ function that gets a structure pointer like parameter. The structure has a field that contains the structure length and other fields. My problem is that...
2
by: Steve Turner | last post by:
I have read several interesting posts on passing structures to C dlls, but none seem to cover the following case. The structure (as seen in C) is as follows: typedef struct tag_scanparm { short...
8
by: Charles Law | last post by:
Can anyone suggest how I would marshal a variable length structure back from an API call. Specifically, I am looking at the WaitForDebugEvent function, which returns a DEBUG_EVENT structure. ...
15
by: Charles Law | last post by:
I have adapted the following code from the MSDN help for PropertyInfo SetValue. In the original code, the structure MyStructure is defined as a class MyProperty, and it works as expected. There is...
3
by: Kiran B. | last post by:
Hi, I am new to .net. I have two Data Structure Type ... Sturcture A and Structure B. Structure A Public Fname as String Public LastName as String Public City as String Public Zip as String...
10
by: David Fort | last post by:
Hi, I'm upgrading a VB6 app to VB.net and I'm having a problem with a call to a function provided in a DLL. The function takes the address of a structure which it will fill in with values. I...
5
by: =?Utf-8?B?QXlrdXQgRXJnaW4=?= | last post by:
Hi Willy, Thank you very much for your work. C++ code doesnot make any serialization. So at runtime C# code gives an serialization error at "msg_file_s sa = (msg_file_s) bf.Deserialize(ms);"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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,...
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...
0
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,...

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.