On Wed, Mar 30, 2016 at 09:16:22AM +0200, Edward Bartolo wrote: > Hi and many thanks for the replies, > > I can understand that a pointer being an address depends heavily on > machine architecture which means, on 32 bit machines it is 4 bytes > long and on 64 bit machines it is 8 bytes long. I also understand that > a pointer variable is essentially made of two parts as illustrated > below: > > address [always allocated] ------------------> data [not allocated > automatically] > > The address does depend on architecture but the data? And what else > can enter into a pointer's definition other than what I illustrated?
Some machines (I'm thinking of, say, the PDP-10, which had a 36-bit wors soze, and, if I remember correctly, eighteen-bit addresses) found that it was good to stuff many characters into a single addressible machine word. I think the PDP-10 stuffed five seven-bit characters into a word, leaving the sign bit unmolested. But sometime it was necessary to address intividual characters within a word. To this eend, they made special character pointers, which were a few bits longer than a regular address. So character pointers were not the same size as regular pointers. There are have also been systems where a function pointer has two compononts -- the address of the code to be executed and the address of the environment the function is to operate in. There are historical reasos for that (mostly having to do with programming language that are not C), but on machines designed for that, function pointers will be bigger than data pointers. But C is part of the legacy of 8-bit bytes and byte-addressable machines. -- hendrik _______________________________________________ Dng mailing list [email protected] https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
