TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: TIM HUTZLER
from: JONATHAN DE BOYNE POLLARD
date: 1998-01-15 14:07:00
subject: how should I return

 TH>>  Actually, the pointer *exists*, but the stack frame
 TH>>  probably is clobbered. The result is the same, no string.
 KK>> Right. It's a valid address, but it is Wrigley Field.
 KK>> Jake and Elwood aren't there. ( Blues Brothers Reference )
 TH> [grin]
It should be noted that Standard C++ *doesn't* guarantee that a pointer that 
has been passed to free() or delete[] is valid afterwards, and even implies 
that use of the *value* of such a pointer (i.e. *without* applying the 
indirection operator) will result in undefined behaviour.  
This is to allow C++ implementations on hardware architectures such as the 
AS/400, or Intel compatible CPUs running in 16-bit protected mode, where 
returning memory to the operating system, via the Standard Library, results 
in an address that cannot be loaded into the CPU's registers without causing 
an exception.
Non-segmented archtectures, such "flat model" 32-bit protected mode C++ 
implementations on Intel compatible CPUs, are more forgiving, and generally 
one can get away with using a pointer value after passing it to free() or 
delete[] on such architectures, but that doesn't change what the C++ Standard 
actually *says*.
 ¯ JdeBP ®
--- FleetStreet 1.19 NR
---------------
* Origin: JdeBP's point, using Squish (2:440/4.3)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.