From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2adc22b0e703907e X-Google-Attributes: gid103376,public From: Keith Thompson Subject: Re: Representation question (void *) Date: 1999/11/16 Message-ID: #1/1 X-Deja-AN: 549604629 Sender: kst@king.cts.com References: <7E47A2C771ADD211AD3C00A0C960172D01269B57@ISCPORTSEX> X-Trace: thoth.cts.com 942824432 35612 198.68.168.21 (17 Nov 1999 07:40:32 GMT) Organization: CTS Network Services Newsgroups: comp.lang.ada X-Complaints-To: newsmaster@cts.com Date: 1999-11-16T00:00:00+00:00 List-Id: "Lipscomb, Kevin" writes: > How would one represent the following C declaration in Ada 95? > > void *data; > > Is this just a placeholder for a pointer that should never be referenced? The following is from an article I posted a few months ago. My suggestion: type Void_Pointer is private; Null_Void_Pointer : constant Void_Pointer; ... type Void_Pointer is new Interfaces.C.Strings.chars_ptr; Null_Void_Pointer : constant Void_Pointer := Interfaces.C.Strings.Null_Ptr; By making it a private type, you avoid making the operations in Interfaces.C.Strings visible to clients. The closest semantic equivalent to C's void* is Ada's System.Address. This is *almost* certain to be compatible (I doubt that there's an existing system on which they're different), but the language doesn't guarantee it. -- Keith Thompson (The_Other_Keith) kst@cts.com San Diego Supercomputer Center <*> "Oh my gosh! You are SO ahead of your time!" -- anon.