Article View: comp.std.c++
Article #1212Re: Zero-length structures and pointer comparisons
From: Jim Adcock
Date: Fri, 11 Dec 1992 23:37
Date: Fri, 11 Dec 1992 23:37
10 lines
957 bytes
957 bytes
In article <KANZE.92Dec10174617@slsvdnt.us-es.sel.de> kanze@us-es.sel.de (James Kanze) writes: | int cmp = memcmp( &ptr1 , &ptr2 , sizeof( void* ) ) ; | |This works on all implementations I can think of. Is it guaranteed? Also, Cray uses very different pointer implementations for char* verses other types of pointers, since the natural address granularity on the Cray is too large to make a good char*. Thus sizeof(char*) != sizeof(int*) for example. [I don't know what sizeof(void*) would compare to -- char* or int*]
Technical Details
Message-ID:
<1992Dec11.233748.12815@microsoft.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!microsoft!hexnut!jimadReferences:
<1992Dec8.103218.27689@lth.se> <9234423.15066@mulga.cs.mu.OZ.AU> <KANZE.92Dec10174617@slsvdnt.us-es.sel.de>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++ Path: arc1-ca.pugleaf.net!sparky!uunet!microsoft!hexnut!jimad From: jimad@microsoft.com (Jim Adcock) Subject: Re: Zero-length structures and pointer comparisons Message-ID: <1992Dec11.233748.12815@microsoft.com> Date: 11 Dec 92 23:37:48 GMT Organization: Microsoft Corporation References: <1992Dec8.103218.27689@lth.se> <9234423.15066@mulga.cs.mu.OZ.AU> <KANZE.92Dec10174617@slsvdnt.us-es.sel.de> Lines: 11