473,785 Members | 2,219 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

structure paddind

how to stop or change structure padding ???
Mar 5 '08 #1
5 1466
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_RANG E 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.or g>,
Keith Thompson <ks***@mib.orgw rote:
>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.or g>,
Keith Thompson <ks***@mib.orgw rote:
>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
11954
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# using memory mapped file. We already have C++ code for handling memory mapped file. I am working on converting code for memory mapped file in C#. Now I have to pass pointer to the above structure. I converted this structure to C# as follows:
26
7096
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 the structure inside the array. When I try this, an error about late assignment appears. Is it possible to assign a value to a structure field that is in an array? I'm currently getting around the problem by creating a new structure, assign...
4
3897
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 each 'double' fields get 12 bytes instead of 8 so the structure length results wrong. '----Sample
2
4845
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 cmd; short fdc; WORD dsf; short boxcar; short average; short chan_ena;
8
3325
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. However, the DEBUG_EVENT structure is defined as a union, and the size and contents vary depending on the event code contained in the header. typedef struct _DEBUG_EVENT { DWORD dwDebugEventCode; DWORD dwProcessId;
15
8242
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 also a minor change in class Mypropertyinfo, which I have commented out. When using a structure, however, the second call to GetValue returns "Default caption". Can anyone tell me why, and how I can make this work? <code> Imports System
3
8901
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 End Structure
10
4996
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 get an error: ---------------- An unhandled exception of type 'System.NullReferenceException' occured in
5
3797
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);" I thought that it is very hard to memory map structure array. I need both read and write memory mapped file at both side of C# and C++.
0
9646
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, 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...
0
10157
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
10096
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
9956
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
6742
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
5514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
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
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2887
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.