Hi Uwe, Uwe Kleine-König wrote: > On Wed, Jun 20, 2012 at 05:08:52PM +0200, Juergen Beisert wrote: > > Marc Kleine-Budde wrote: > > > [...] > > > > > > > + > > > > +#include <common.h> > > > > +#include <init.h> > > > > +#include <environment.h> > > > > +#include <globalvar.h> > > > > +#include <reset_source.h> > > > > + > > > > +static const char name[] = "global.system.reset"; > > > > +static const char unknown_reset[] = "unknown"; > > > > +static const char power_on_reset[] = "POR"; > > > > +static const char manual_reset[] = "RST"; > > > > +static const char watchdog[] = "WDG"; > > > > +static const char wake[] = "WKE"; > > > > +static const char jtag[] = "JTAG"; > > > > > > what about using an array > > > > > > static cost char *reset_reason_array[] = { > > > [RESET_UKWN] = "unknown", > > > ... > > > }; > > > > The result is not the same. The strings are no longer "const". But it > > should > > <kidding>Of course they are not "const" if you write "cost".</kidding> > Using > > static const char * const reset_reason_array[] = { > > should do the trick. No, it doesn't. Only this would: static const bla[] = "this is a really constant string"; static const char * const reset_reason_array[] = { [0] = bla, [...] }; But its ugly. So I will prefer Marc's suggestion. > Having said that, I wonder what is the difference between > > static const char wake[] = "WKE"; > ... use wake here ... > > and > > ... just use "WKE" ... Just based on how U-Boot does it. jbe -- Pengutronix e.K. | Juergen Beisert | Linux Solutions for Science and Industry | Phone: +49-5121-206917-5128 | Vertretung Sued/Muenchen, Germany | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de/ | _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox