[mingw - C/C++] Size of common symbols

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[mingw - C/C++] Size of common symbols

SourceForge.net

Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=3207750
By: patsakh


    Hello.

I have the question: Why GCC uses a rounded size for
common variables? For example, from this program

char  gc;
short gs;
long  gl;

int main()
{
    static char  lc = 0;
    static short ls = 0;
    static long  ll = 0;

    return 0;
}

the C compiler generates the following assembly code

 ...
.lcomm _lc.0,16
.lcomm _ls.1,16
.lcomm _ll.2,16
 ...
.comm _gc, 16 # 1
.comm _gs, 16 # 2
.comm _gl, 16 # 4

i.e. all symbols have a size 16 bytes...


______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=286529


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users