All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hin-Tak Leung <htl10@users.sourceforge.net>
To: Johannes Berg <johannes@sipsolutions.net>, okias <d.okias@gmail.com>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
	linville@tuxdriver.com, linux-wireless@vger.kernel.org,
	herton@mandriva.com.br
Subject: Re: [PATCH] v2: rtl8187: micro cleanup
Date: Wed, 17 Feb 2010 12:47:00 -0800 (PST)	[thread overview]
Message-ID: <536092.79402.qm@web23108.mail.ird.yahoo.com> (raw)
In-Reply-To: <c2673ca61002171038u14c7ab2fnf2d3ce2067bd1fd8@mail.gmail.com>

--- On Wed, 17/2/10, okias <d.okias@gmail.com> wrote:

> You have probably right, but when I
> use my testing program:
> 
> #include <stdio.h>
> main() {
> int a;
> printf("%i\n", a);
> a |= 22;
> printf("%i\n", a);
> }
> 
> Output is:
> 0
> 22
> 
> it look correct to me

It is wrong - you are relying on and depending on the compiler zero'ing uninitialized variables for you - which, depends on which compiler you are using, optimization level, etc, may or may not happen. (some compiler does that, under some conditions/optimizations, but you cannot depend on that).

> 
> 
> 2010/2/17 Johannes Berg <johannes@sipsolutions.net>:
> > On Wed, 2010-02-17 at 19:34 +0100, okias wrote:
> >> I did test on small C program, and "int a" is
> equal to int a = 0; so
> >> it should be fine, but maybe I'm wrong.
> >
> > It's not equal. It will be uninitialised stack garbage
> if you don't
> > initialise it.
> >
> > johannes
> >
> 
> 
> 
> -- 
> Jabber/XMPP: okias@isgeek.info
> SIP VoIP: sip:17474537254@proxy01.sipphone.com
> 


      

      parent reply	other threads:[~2010-02-17 20:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-17 18:15 [PATCH] v2: rtl8187: micro cleanup okias
2010-02-17 18:30 ` Larry Finger
2010-02-17 18:34   ` okias
2010-02-17 18:36     ` Johannes Berg
2010-02-17 18:38       ` okias
2010-02-17 18:58         ` Pavel Roskin
2010-02-17 19:04           ` okias
2010-02-17 19:13             ` Sedat Dilek
2010-02-17 21:14               ` Hin-Tak Leung
2010-02-17 22:44             ` Pavel Roskin
2010-02-17 20:47         ` Hin-Tak Leung [this message]

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=536092.79402.qm@web23108.mail.ird.yahoo.com \
    --to=htl10@users.sourceforge.net \
    --cc=Larry.Finger@lwfinger.net \
    --cc=d.okias@gmail.com \
    --cc=herton@mandriva.com.br \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.