From: "Ihar 'Philips' Filipau" <filia@softhome.net>
To: Denis Vlasenko <vda@port.imtp.ilyichevsk.odessa.ua>
Cc: Mikael Pettersson <mikpe@user.it.uu.se>,
Linux Kernel ML <linux-kernel@vger.kernel.org>,
Paul Wagland <paul@wagland.net>
Subject: Re: [PATCH][2.6.6-rc3] gcc-3.4.0 fixes
Date: Thu, 29 Apr 2004 23:35:24 +0200 [thread overview]
Message-ID: <4091751C.7070507@softhome.net> (raw)
In-Reply-To: <200404292354.37091.vda@port.imtp.ilyichevsk.odessa.ua>
Denis Vlasenko wrote:
> On Thursday 29 April 2004 12:30, Ihar 'Philips' Filipau wrote:
>
>>Mikael Pettersson wrote:
>>
>>>This patch fixes three warnings from gcc-3.4.0 in 2.6.6-rc3:
>>>- drivers/char/ftape/: use of cast-as-lvalue
>>> if (get_unaligned((__u32*)ptr)) {
>>>- ++(__u32*)ptr;
>>>+ ptr += sizeof(__u32);
>>> } else {
>>
>> Can anyone explain what is the problem with this?
>> To me it seems pretty ligitimate code - why it was outlawed in gcc 3.4?
>
>
> cast is not a lvalue. ++(__u32*)ptr is nonsense, just like ++4.
>
Yes. I see. C goes in direction of C++.
For me cast in C is always "forget original type and assume this type."
From this standpoint it makes a lot of sense. Is just like
((stuct { char a,b,c,d;})4).a - never tryed it in gcc (3.3 does not
accept it), but IIRC was possible on old PC C compilers - Turbo C 2/3 -
not sure name/version, but I used it. (Yes! recalled - M$VC/winbase.h
use this kind of macros for manipulating bytes/words/dwords/etc)
And in old C classes it was always said that in C you can convert
anything to everything, it just size of types must be the same.
Why not after all?
>
> ptr = (void*) ((char*)ptr + sizeof(__u32));
No Nice, But Accepted.
I have just checked my code base - I do not use this feature in any
way ;-)
--
Ihar 'Philips' Filipau / with best regards from Saarbruecken.
-- _ _ _
A programmer is a person who passes as an exacting expert |_|*|_|
on the basis of being able to turn out, after innumerable |_|_|*|
punching, an infinite series of incomprehensible answers |*|*|*|
calculated with micrometric precisions from vague
assumptions based on debatable figures taken from inconclusive
documents and carried out on instruments of problematical accuracy
by persons of dubious reliability and questionable mentality for
the avowed purpose of annoying and confounding a hopelessly
defenseless department that was unfortunate enough to ask for the
information in the first place.
-- IEEE Grid newsmagazine
next prev parent reply other threads:[~2004-04-29 21:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1PX8S-5z2-23@gated-at.bofh.it>
2004-04-29 9:30 ` [PATCH][2.6.6-rc3] gcc-3.4.0 fixes Ihar 'Philips' Filipau
2004-04-29 20:46 ` Paul Wagland
2004-04-29 20:54 ` Denis Vlasenko
2004-04-29 21:35 ` Ihar 'Philips' Filipau [this message]
2004-04-29 21:46 Mikael Pettersson
2004-05-17 0:58 ` H. Peter Anvin
2004-06-01 14:52 ` Mikael Pettersson
2004-06-01 15:09 ` William Lee Irwin III
2004-06-01 15:35 ` Mikael Pettersson
2004-06-01 15:38 ` Andreas Schwab
2004-06-01 17:09 ` H. Peter Anvin
2004-06-01 17:14 ` H. Peter Anvin
2004-06-01 21:47 ` Mikael Pettersson
2004-06-01 17:27 ` Linus Torvalds
2004-06-01 19:34 ` Chris Wedgwood
2004-07-16 4:28 ` H. Peter Anvin
-- strict thread matches above, loose matches on Subject: below --
2004-04-28 13:07 Mikael Pettersson
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=4091751C.7070507@softhome.net \
--to=filia@softhome.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mikpe@user.it.uu.se \
--cc=paul@wagland.net \
--cc=vda@port.imtp.ilyichevsk.odessa.ua \
/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