public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joel Soete <soete.joel@tiscali.be>
To: Vojtech Pavlik <vojtech@suse.cz>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
	marcelo.tosatti@cyclades.com
Subject: Re: Some cleanup patches for: '...lvalues is deprecated'
Date: Sat, 03 Jul 2004 21:39:24 +0000	[thread overview]
Message-ID: <40E7278C.8040001@tiscali.be> (raw)
In-Reply-To: <20040703205621.GA1640@ucw.cz>

Thanks first for your attention ;)

Vojtech Pavlik wrote:
> On Sat, Jul 03, 2004 at 12:53:21PM +0000, Joel Soete wrote:
> 
>>Hi Marcelo,
>>
>>Please appolgies first for wrong presentation of previous post (that was 
>>the first and certainly the last time that I used the 'forwarding' option 
>>of this webmail interface :( ).
>>
>>Here are some backport to clean up some warning of type: use of cast 
>>experssion
>>as lvalues is deprecated.
>>--- linux-2.4.27-rc2-pa4mm/kernel/sysctl.c.Orig	2004-06-29 
>>09:03:42.000000000 +0200
>>+++ linux-2.4.27-rc2-pa4mm/kernel/sysctl.c	2004-06-29 
>>10:10:31.588030256 +0200
>>@@ -890,7 +890,7 @@
>> 				if (!isspace(c))
>> 					break;
>> 				left--;
>>-				((char *) buffer)++;
>>+				buffer += sizeof(char);
> 
> 
> This (although correct in the end) is a wrong thing to do.
> 
> It seems to look like the intention is to move the pointer by a char's
> size, however your change is equivalent to:
> 
> 	buffer += 1;
> 
> And if buffer wasn't void*, which it fortunately is, it would, unlike
> the older construction, move the pointer by a different size.
> 
Very interesting but well I am not enough fluent in C to understand this fine detail :(
Can you explain me by an example (let say a long*) what would did "((char *) buffer)++;" versus "buffer += sizeof(char);"
(Don't worry, if don't have time, I will perfectly understand and will experiment by myself)

> So just use
> 
> 	buffer++;
> 
> here, and the intent is then clear.
> 
Yes ;)
> 
>>--- linux-2.4.27-rc2-pa4mm/drivers/video/fbcon.c.Orig	2004-06-29 
>>10:47:31.901491304 +0200
>>+++ linux-2.4.27-rc2-pa4mm/drivers/video/fbcon.c	2004-06-29 
>>11:13:31.846343640 +0200
>>@@ -1877,7 +1877,10 @@
>>        font length must be multiple of 256, at least. And 256 is multiple
>>        of 4 */
>>     k = 0;
>>-    while (p > new_data) k += *--(u32 *)p;
>>+    while (p > new_data) {
>>+        p = (u8 *)((u32 *)p - 1);
>>+        k += *(u32 *)p;
>>+    }
> 
> 
> 
> How about
> 
> 	p -= 4;
> 	k += *(u32 *)p;
> 
:)

Thanks again,
	Joel

  reply	other threads:[~2004-07-03 21:39 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-03 12:53 Some cleanup patches for: '...lvalues is deprecated' Joel Soete
2004-07-03 20:56 ` Vojtech Pavlik
2004-07-03 21:39   ` Joel Soete [this message]
2004-07-03 21:45     ` Vojtech Pavlik
2004-07-05  5:10   ` Daniel Jacobowitz
2004-07-05  8:59     ` David Vrabel
2004-07-05 11:59     ` Joel Soete
2004-07-27 12:54       ` Marcelo Tosatti
2004-07-27 15:59         ` Joel Soete
2004-07-27 15:59         ` Joel Soete
2004-07-27 16:31           ` Jon Oberheide
2004-07-30  9:11             ` Joel Soete
2004-07-30 12:51               ` Joel Soete
2004-07-30 17:29                 ` Joel Soete
  -- strict thread matches above, loose matches on Subject: below --
2004-07-31  8:41 Mikael Pettersson
2004-08-01 10:40 ` Adrian Bunk
2004-08-02 11:34 Mikael Pettersson
2004-08-02 23:08 ` Adrian Bunk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40E7278C.8040001@tiscali.be \
    --to=soete.joel@tiscali.be \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.com \
    --cc=vojtech@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox