Hi all,
I saw in one function that its return type was written as PACKED...I wasnt
sure what that would mean. Any pointers on this?
Also, what is the significance of specifically mentioning the LOCAL to a
function definition when it will be a local function without the access of
its declaration?
Thanks
Murali 6 1844
Muralidhar wrote: Hi all,
I saw in one function that its return type was written as PACKED...I wasnt sure what that would mean. Any pointers on this?
Also, what is the significance of specifically mentioning the LOCAL to a function definition when it will be a local function without the access of its declaration?
Neither PACKED nor LOCAL has any meaning in "out of
the box" C. They are probably #define'd as macros that
expand to something meaningful, possibly compiler-specific.
-- Er*********@sun .com
Eric Sosman is right, this isn't part of the Standard. However, if you
were wondering what "Packed" means, it usually describes a way to store
several values in one variable. For example, you might have a program
that needs millions of "boolean" values (0 or 1). Using char for that
would be a waste of 7/8th of the memory. You could now write a function
that "packs" 8 boolean values into one char (since char is guaranteed to
be at least 8 bit wide).
Greetings, Chris
Muralidhar wrote: Hi all,
I saw in one function that its return type was written as PACKED...I wasnt sure what that would mean. Any pointers on this?
Also, what is the significance of specifically mentioning the LOCAL to a function definition when it will be a local function without the access of its declaration?
Thanks Murali
--
Christian Staudenmayer
University of Ulm, Germany cs****@gmail.co m
To follow up on what others have said, packed is a variable attribute
provided by the GCC[0] as an extension. This is documented in the
(tex)info manual, which if installed can be accessed via the command:
info gcc 'C Extensions' 'Variable Attributes'
-trent
[0] And possibly others, I don't know.
Trent Buck <NO************ @bigpond.com> writes: To follow up on what others have said, packed is a variable attribute provided by the GCC[0] as an extension.
But it isn't written PACKED. There is probably macro trickery
going on here.
--
int main(void){char p[]="ABCDEFGHIJKLM NOPQRSTUVWXYZab cdefghijklmnopq rstuvwxyz.\
\n",*q="kl BIcNBFr.NKEzjwC IxNJC";int i=sizeof p/2;char *strchr();int putchar(\
);while(*q){i+= strchr(p,*q++)-p;if(i>=(int)si zeof p)i-=sizeof p-1;putchar(p[i]\
);}return 0;}
Yup...the GCC reference for that was __packed.
I guess it must be a typedef since the compiler/linker has to know when to
pack ...am I right?
murali
"Ben Pfaff" <bl*@cs.stanfor d.edu> wrote in message
news:87******** ****@benpfaff.o rg... Trent Buck <NO************ @bigpond.com> writes:
To follow up on what others have said, packed is a variable attribute provided by the GCC[0] as an extension. But it isn't written PACKED. There is probably macro trickery going on here. -- int main(void){char
p[]="ABCDEFGHIJKLM NOPQRSTUVWXYZab cdefghijklmnopq rstuvwxyz.\ \n",*q="kl BIcNBFr.NKEzjwC IxNJC";int i=sizeof p/2;char *strchr();int
putchar(\ );while(*q){i+= strchr(p,*q++)-p;if(i>=(int)si zeof p)i-=sizeof
p-1;putchar(p[i]\ );}return 0;}
Muralidhar wrote: Yup...the GCC reference for that was __packed.
I guess it must be a typedef since the compiler/linker has to know when to pack ...am I right?
I'm guessing that it's a macro defined somewhere in the source code.
--
pete This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: maniac |
last post by:
Hey guys, I'm new here, just a simple question.
I'm learning to Program in C, and I was recommended a book called,
"Mastering C Pointers", just asking if any of you have read it,
and if it's worth the $25USD.
I'm just looking for a book on Pointers, because from what I've
read it's one of the toughest topics to understand.
thanks in advanced.
|
by: ccwork |
last post by:
Hi all,
Here is a sample code segment:
....
typedef PACKED struct
{
union
{
PACKED struct
{
char red:1;
|
by: bingfeng |
last post by:
I have some codes generated by perl, in which initialize some huge
struct,such as
PARA TOS_network_spantree_set_0_para_0 = { "vlan", emNUM, NULL, "",
"configuration on a designated vlan", PRO_REQUIRED };
const char* TOS_network_spantree_set_0_para_1_emvalue = { "disable",
"enable", NULL };
PARA TOS_network_spantree_set_0_para_1 = { "", emENUM,
TOS_network_spantree_set_0_para_1_emvalue, "", "enable or disable STP",
PRO_REQUIRED };
|
by: Amaryllis |
last post by:
Hi again,
I'm new to the world of communicating between VB.NET and AS/400, so
I've been posting a lot of questions lately since no one else in the
company has done anything like this before. Hopefully, this one is
fairly simple. I'm trying to insert records into a table on the 400.
I can insert into a packed field that has no decimal places and into
the alphanumeric fields as well. Everything seems to translate
except the values that...
|
by: parag.kanade |
last post by:
I have a packet structure which has a field of Integer arrays, that is
packed struct
{
int a;
char b;
int count;
}foo;
I need to initialize all the entries of count to a particular value,
| |
by: Daniel Rudy |
last post by:
What is the difference between packed and unpacked structs?
--
Daniel Rudy
Email address has been base64 encoded to reduce spam
Decode email address using b64decode or uudecode -m
Why geeks like computers: look chat date touch grep make unzip
|
by: Doru Roman |
last post by:
Hi,
Can somebody tell me what is a packed variable?
For example a packed 32-bit integer. Is it the same as unsigned?
Thanks
|
by: Sikandar |
last post by:
Hi,
I am beginner in C. Pls let me know what is packed array in C. Where
is it used?
Thanks,
Sikandar
|
by: emyl |
last post by:
Hi all,
here's an elementary question. Assume I have declared two variables,
char *a, **b;
I can then give a value to a like
a="hello world";
|
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: 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...
| |
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: 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();...
|
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.
| |