🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: bnr.lang.c++
Article #6

Re: Is pointer in my address space?

#6
From: David Kastrup
Date: Mon, 12 Oct 1992 21:56
20 lines
1571 bytes
crlstu4@bnr.ca (Goetz von Escher) writes:


>Hi there!

>Is there a way to find out if a pointer is a valid pointer in C/C++?
>Or in other words: If I want to read a value in memory, how do I
>know wether I can read the value at this address without causing
>an exception (bus error, segmentation fault and that stuff)?

>Anything?
>Goetz
The ARM says you can't. Burn candles and sing. On the other side, if
you have to check whether you can store your values, you have a lousy program.
One does not just use any memory which does not cause a violation, you
know. If you really are into muck, try catching the segmentation violation,
and other signals. You will have to return through some setjmp/longjmp-
construct, but this stinks. If you get a violation, it
has good reason. Trying in any way to ignore or circumvent it is
madness. Be glad the MMU is there to protect you from your folly!
Technical Details
Message-ID: <dak.718927004@tabaqui>
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!ames!haven.umd.edu!darwin.sura.net!spool.mu.edu!umn.edu!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!Urmel.Informatik.RWTH-Aachen.DE!tabaqui!dak
References: <1992Oct9.160154.2427@bnr.ca>

Show Full Headers
Complete Article Headers
Newsgroups: bnr.lang.c++,comp.lang.c++
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!ames!haven.umd.edu!darwin.sura.net!spool.mu.edu!umn.edu!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!Urmel.Informatik.RWTH-Aachen.DE!tabaqui!dak
From: dak@tabaqui.informatik.rwth-aachen.de (David Kastrup)
Subject: Re: Is pointer in my address space?
Message-ID: <dak.718927004@tabaqui>
Keywords: process address memory pointer
Sender: news@Urmel.Informatik.RWTH-Aachen.DE (Newsfiles Owner)
Nntp-Posting-Host: tabaqui
Organization: Rechnerbetrieb Informatik  /  RWTH Aachen
References: <1992Oct9.160154.2427@bnr.ca>
Date: 12 Oct 92 21:56:44 GMT
Lines: 20