Article View: comp.std.c++
Article #3977Re: C++ syntactic trap
From: Sean A Corfield
Date: Wed, 10 Apr 1996 11:21
Date: Wed, 10 Apr 1996 11:21
25 lines
1784 bytes
1784 bytes
In article <4k3q4p$lkd@syn.cs.cornell.edu>, vavasis@CS.Cornell.EDU (Stephen Vavasis) wrote: |> The troubling thing about this trap is that none of the unix |> compilers I tried (gcc-2.7.2, Sun SC3.0.1, HP-UX cfront 3.0.3) issued |> a warning about the mistake, even on the highest warning level. Only |> Visual C++4.0 observed that there might be a problem. Here is an |> example of the trap. ... |> char* a = new char(sz + 1); // bug is here, but syntax is legal. Perhaps you should try one of the C++ lints? There are many, many areas where the (draft) standard allows constructs of dubious value but the committee have always been careful not to remove a construct solely on the grounds that programmers might shoot themselves in the foot. Sean A Corfield Object Consultancy Services C++ - Beyond the ARM - http://nw.demon.co.uk/ocsltd/c++/ --- [ comp.std.c++ is moderated. To submit articles: try just posting with ] [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ] [ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ] [ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ] [ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Technical Details
Message-ID:
<AD9145EF96685D5D@corf.demon.co.uk>Path:
arc1-ca.pugleaf.net!in1.uu.net!bounce-backReferences:
<4k3q4p$lkd@syn.cs.cornell.edu>Show Full Headers
Complete Article Headers
From: Sean A Corfield <sean@corf.demon.co.uk> Message-ID: <AD9145EF96685D5D@corf.demon.co.uk> X-Original-Date: Wed, 10 Apr 1996 11:03:11 +0100 Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back Date: 10 Apr 96 11:21:32 GMT Approved: fjh@cs.mu.oz.au Newsgroups: comp.std.c++ Subject: Re: C++ syntactic trap Organization: OCS References: <4k3q4p$lkd@syn.cs.cornell.edu> X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUBMWuZwOEDnX0m9pzZAQGjawF/f50Mn75KtT+U/wbXM3rsvrkm3jA7qV0j y5NqDLsWXCJeoknQHWqLincoASjeGLrJ =SiZF