mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Alessandro Rubini <rubini-list@gnudd.com>
Cc: barebox@lists.infradead.org, embedded24@evers-fischer.de
Subject: Re: [PATCH] automount: check for recursive automount
Date: Thu, 3 Jul 2014 11:33:21 +0200	[thread overview]
Message-ID: <20140703093321.GU14781@pengutronix.de> (raw)
In-Reply-To: <20140703090045.GA21384@mail.gnudd.com>

On Thu, Jul 03, 2014 at 11:00:45AM +0200, Alessandro Rubini wrote:
> > static variables are initialized to 0 (for pointers: NULL) by the
> > compiler.
> 
> Well, not really. The compiler just places them in the .bss area.  It
> is barebox, it is run-time initialization, that zeroes bss.
> 
> So it is barebox, not the compiler.
Yeah, in general it's even worse because there might be platforms where
NULL isn't represented by a literal 0. (Not sure if something like this
exists, but it's allowed by the standard.)

C99 tells us:

If an object that has automatic storage duration is not initialized explicitly,
its value is indeterminate. If an object that has static storage duration is
not initialized explicitly, then:
- if it has pointer type, it is initialized to a null pointer;
- if it has arithmetic type, it is initialized to (positive or unsigned) zero;
- if it is an aggregate, every member is initialized (recursively) according to
  these rules;
- if it is a union, the first named member is initialized (recursively)
  according to these rules.

I assume it's included in earlier standards, too, but I don't have these
handy.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2014-07-03  9:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-03  8:34 Rolf Evers-Fischer
2014-07-03  8:51 ` Uwe Kleine-König
2014-07-03  9:00 ` Alessandro Rubini
2014-07-03  9:33   ` Uwe Kleine-König [this message]
2014-07-03 11:05     ` Rolf Evers-Fischer
  -- strict thread matches above, loose matches on Subject: below --
2014-07-03  6:21 Sascha Hauer

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=20140703093321.GU14781@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=embedded24@evers-fischer.de \
    --cc=rubini-list@gnudd.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox