On Thu, Jul 25, 2013 at 5:39 PM, Dan Gora <dan.g...@gmail.com> wrote: >> First of all, thanks looking into it. >> I can compare "old" code with a new one, but I don't anything big >> endian ready to test at. And I don't feel like setting up QEMU-ARM >> right now. However, I can share small code snippet with a test >> code(later). > > I have a big endian setup, but honestly I don't even know what this > dcmi stuff is or if it's relevant to my ATCA setup or if I can test > it.. I'll have a quick look later when I get to the office. >
DCMI is some M$ server power management thing or whatnot. I believe trying out similar code snippet should be enough to verify it works as expected. Please, can you test http://pastebin.com/1ideZhjn ? Not that it's of any help, but output at x86-64: ~~~ 0: '128' 1: '62' 2: '128' 3: '62' 4: '160' 5: '255' 6: '255' 7: '255' 8: '160' 9: '255' 10: '255' 11: '255' 12: '56' 13: '81' 14: '56' 15: '81' 16: '0' 17: '0' 18: '0' 19: '0' ~~~ >> Hm, I see your point. Perhaps a dumb question, but do you mean only >> variables or structures/arrays as well? > > Both. The gcc compiler cannot pick out used, but uninitialized fields > from a structure (other compilers might), but IMHO it's better to > explicitly initialize the structure near where it's going to be used > so that people can see that you're explicitly initializing it and know > that you didn't just forget about it. > [...code example...] I sort of wish I knew why, but ok and I'll try to remember. Still, the diff between ``int i = 0;'' V. ``int i; i = 0;'' is just ... I guess beyond my understanding, resp. knowledge :| > Also, remember that: > > uint8_t data[256] = {0}; > > does not zero all the elements of 'data', only the first element. Damn! You're absolutely right! I always forget about this. I did write it down this time and I hope I'll remember it from now on. Also, 'data' is being initialized like two lines below. Ehm. > I'm not sure really about this particular case, but (IHMO) you should > leave it uninitialized in the declaration and if you know that there > is a code path where it's not going to get initialized, initialize it > in that code path. Either that or set it to some default value close > by the first use of that variable so that the reader knows that it's > supposed to have some default value and that default value has not > scrolled off the top of the screen. > The problem is nobody does it(init). And further you go from your declarations the easier is to forget about it. Then only one bit is initialized and the rest of structure is left at "random". But this is beyond discussion whether to initialize in the declaration or later in the code. Simply - ok. Z. ------------------------------------------------------------------------------ See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk _______________________________________________ Ipmitool-devel mailing list Ipmitool-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ipmitool-devel