This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch to deprecate casts as lvalues for C


On Wed, 22 Oct 2003, Zack Weinberg wrote:

> I would suggest that you add another example to the release notes,
> illustrating the former obstack.h usage.  I had to stare at the
> obstack code a little to understand that yes, it was a use of the same
> extension.

This is the patch I've applied to the release notes, giving an example of
inrementing a casted pointer.

Index: changes.html
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-3.4/changes.html,v
retrieving revision 1.56
diff -u -r1.56 changes.html
--- changes.html	12 Oct 2003 21:02:55 -0000	1.56
+++ changes.html	22 Oct 2003 22:31:22 -0000
@@ -76,6 +76,21 @@
 	a correct implementation of <code>#import</code> and
         <code>#pragma once</code>.
 	These two directives have therefore been un-deprecated.</li>
+    <li>The cast-as-lvalue extension has been removed for C++ and
+        deprecated for C and Objective-C.  In particular,
+        code like this:
+        <pre>
+        int i;
+        (char) i = 5;
+        </pre>
+        <p>or this:</p>
+        <pre>
+        char *p;
+        ((int *) p)++;
+        </pre>
+        <p>is no longer accepted for C++ and will not be accepted for
+        C and Objective-C in a future version.</p></li>
+
   </ul>
 
 <h3>C++</h3>
@@ -211,14 +226,6 @@
         the declaration of <code>g</code> before the declaration of
 	<code>f</code>.  The default arguments for <code>g</code> must
 	be visible at the point where it is called.</p></li>
-
-    <li>The cast-as-lvalue extension has been removed.  In particular,
-        code like this:
-        <pre>
-        int i;
-        (char) i = 5;
-        </pre>
-        <p>is no longer accepted.</p></li>
 
     <li>The C++ ABI Section 3.3.3 specifications for the array
         construction routines <code>__cxa_vec_new2</code> and

-- 
Joseph S. Myers
jsm@polyomino.org.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]