Article View: gnu.gcc.help
Article #49523Is there any way to check for reading/writing beyond array limits?
From: Ernst Niebur
Date: Thu, 20 Jan 1994 22:29
Date: Thu, 20 Jan 1994 22:29
33 lines
2181 bytes
2181 bytes
Well, I am posting this after having cursed the "flexibility" of the C language many times. I spend a significant fraction of all the time I do program development on debugging errors which are caused by reading/writing beyond the borders of arrays and other data structures. There are many things I like about C, but I loathe the "possibility" to go beyond declared array borders, and that WITHOUT A WARNING. Of course there are cases in which you may want to do that. It would also probably be inefficient to check each time you follow a pointer or array index whether this pointer is in the declared part of the data structure. Thing is, I don't care! It sure is very inefficient if _I_ spend three days tracking down an error due to a wrong array index, and I would rather have the machine spend a few minutes on this! My point is that it would be just wonderful if one had the possibility to check for this, even if the compilation or execution becomes very inefficient, and have this as an option that one can switch on and off. So my question is: is there any possibility to do this? Maybe a compiler option I overlooked (I doubt it, though, I believe I checked that quite carefully)? Any help very much appreciated! --Ernst -- Ernst Niebur Phone (818)395 2880 Computation and Neural Systems Fax (818)796 8876 Caltech 139-74 ernst@caltech.edu Pasadena, CA 91125, USA ernst@caltech.bitnet
Technical Details
Message-ID:
<2hn0jn$jt2@gap.cco.caltech.edu>Path:
arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!news.claremont.edu!nntp-server.caltech.edu!isis.klab.caltech.edu!ernstShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,ddf14da43565a1f5,start X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1994-01-21 00:43:06 PST Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!news.claremont.edu!nntp-server.caltech.edu!isis.klab.caltech.edu!ernst From: ernst@isis.klab.caltech.edu (Ernst Niebur) Newsgroups: gnu.gcc.help Subject: Is there any way to check for reading/writing beyond array limits? Date: 20 Jan 1994 22:29:11 GMT Organization: California Institute of Technology Lines: 33 Message-ID: <2hn0jn$jt2@gap.cco.caltech.edu> NNTP-Posting-Host: isis.klab.caltech.edu