Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!princeton!caip!brl-adm!brl-smoke!brl-sem!ron From: ron@brl-sem.ARPA (Ron Natalie ) Newsgroups: net.lang.c Subject: Re: malloc() Message-ID: <267@brl-sem.ARPA> Date: Sun, 1-Jun-86 03:15:03 EDT Article-I.D.: brl-sem.267 Posted: Sun Jun 1 03:15:03 1986 Date-Received: Fri, 20-Jun-86 04:07:35 EDT References: <1005@dataioDataio.UUCP> <113@watmath.UUCP> Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 20 In article <113@watmath.UUCP>, rbutterworth@watmath.UUCP (Ray Butterworth) writes: > There is a need for two special types of generic pointers: one which > is guaranteed to be aligned and can be cast into any other pointer, and > one which has no such guarantee and can have any other pointer cast > into it. (void*) clearly fits the former. (char*) almost fits the > latter (perhaps a new (pointer) type should have been introduced). > X3J11 defeated the niceness of all this by extending their definition > of (void*) to fit both requirements. I really don't understand why > they would do such a thing. It gains nothing and loses a lot. Eh? "void *" is a pointer that is big enough to hold any other pointer. It makes no attempt at alignment. Nowhere in C is there any guarantees on alignment. You assign an unaligned char into an int pointer on some machines it will work, some it won't be aligned right, and some will generate bizarre pointers as a result. It is a feature of MALLOC that it never puts anything into that void* it returns that isn't aligned, but that is extremely implentation dependant. -Ron