Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: Are bad developer libraries the problem with M$ software?

From: Glynn Clements <glynn.clements(at)virgin.net>
Date: Mon Nov 18 2002 - 22:45:19 EST

"" wrote:

> As a follow-up to my post, where I said:

It's nothing to do with the stack; arrays in the data segment are no different to arrays on the stack.

The size of an array is the product of the number of elements and the size of each element. The size of a pointer is fixed, and is normally the same as the platform's "word size" (e.g. 2, 4 or 8 bytes for 16, 32 and 64 bit platforms respectively).

However, it's easy to get confused by the various ways in which C treats arrays and pointers as being equivalent. E.g. arrays are always passed by reference (as a pointer to the start of the array). If you declare a function's argument as an array, e.g.

        void foo(char arg[])

it's actually a pointer.

Do you need help?X

> Once you pass the string around to functions as a char*, or allocate

Note that you would get exactly the same result if the array "x" was in the data segment (a global variable or a "static" local variable) rather than on the stack.

-- 
Glynn Clements 
Received on Tue Nov 19 15:32:46 2002

This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 14:02:44 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library