develooper Front page | perl.perl5.porters | Postings from October 2008

[PATCH] explicit empty while loops

Thread Next
From:
Robin Barker
Date:
October 29, 2008 06:22
Subject:
[PATCH] explicit empty while loops
Message ID:
46A0F33545E63740BC7563DE59CA9C6D4E2FD9@exchsvr2.npl.ad.local
This patch makes while loops with empty bodies more explicit and silences a g++ warning 

Robin Barker
Mathematics and Scientific Computing group
Office: F2-A7  |  Ext: 7090  |  www.npl.co.uk/ssfm

diff -ur ../perl-current/op.c ./op.c
--- ../perl-current/op.c	2008-10-25 13:23:51.000000000 +0100
+++ ./op.c	2008-10-28 18:28:17.000000000 +0000
@@ -8083,7 +8083,7 @@
 		         const char *p = proto;
 			 const char *const end = proto;
 			 contextclass = 0;
-			 while (*--p != '[');
+			 while (*--p != '[') {}
 			 bad_type(arg, Perl_form(aTHX_ "one of %.*s",
 						 (int)(end - p), p),
 				  gv_ename(namegv), o3);
diff -ur ../perl-current/pp_sort.c ./pp_sort.c
--- ../perl-current/pp_sort.c	2008-10-25 13:23:51.000000000 +0100
+++ ./pp_sort.c	2008-10-28 18:28:55.000000000 +0000
@@ -204,7 +204,7 @@
 	    if (r >= t) p = r = t;	/* too short to care about */
 	    else {
 		while (((cmp(aTHX_ *(p-1), *p) > 0) == sense) &&
-		       ((p -= 2) > q));
+		       ((p -= 2) > q)) {}
 		if (p <= q) {
 		    /* b through r is a (long) run.
 		    ** Extend it as far as possible.
End of patch

 <<while_empty.patch>> 


-------------------------------------------------------------------
This e-mail and any attachments may contain confidential and/or
privileged material; it is for the intended addressee(s) only.
If you are not a named addressee, you must not use, retain or
disclose such information.

NPL Management Ltd cannot guarantee that the e-mail or any
attachments are free from viruses.

NPL Management Ltd. Registered in England and Wales. No: 2937881
Registered Office: Serco House, 16 Bartley Wood Business Park,
                   Hook, Hampshire, United Kingdom  RG27 9UY
-------------------------------------------------------------------

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About