2011-02-05 00:01 had a long (5 hour) drive today. came up with a few new contril-oriebted use cases for Ben NN one we have fast serial connectivity, either wired (lowest cost) or wireless 6LoWPAN with wpwrak atBen and atUSB. exicting future for Ben methinks. 2011-02-05 00:02 s/exicting/exciting 2011-02-05 00:40 anybody around? 2011-02-05 01:05 yes me.. but no for long 2011-02-05 01:23 hi 2011-02-05 03:37 Jay7 where in Russia if I might ask? 2011-02-05 07:14 hi all 2011-02-05 07:14 what about USB 3? 2011-02-05 07:14 i must buy a new pc 2011-02-05 07:15 but all the notebook have usb 2 2011-02-05 15:33 C99 how i dint realized u existed before ;-) ! 2011-02-05 15:44 ;-) 2011-02-05 17:37 wpwrak: your mail: what about hemp fibres?!!1! ;) 2011-02-05 17:37 *scnr* ... just kidding 2011-02-05 17:51 roh: robust material, grows easily, bio-degradable, ... sounds perfect ;-) 2011-02-05 18:26 http://www.iso-9899.info/wiki/C_gotchas !! 2011-02-05 18:28 So not fork even if rtems have posix support for it !! 2011-02-05 18:30 (c gotchas) hah, tell me, will this segfault ?  printf("%d\n", 0["abc"]); 2011-02-05 18:30 (c gotchas) unsigned n = 1; printf("%d\n", n > -1); /* true or false ? */ 2011-02-05 18:32 wpwrak: You should write a book :-) 2011-02-05 18:32 Or is already somwhere and i dint realize it yet... 2011-02-05 18:33 how you could try a signed operation with an unsigned variable? 2011-02-05 18:34 0["abc"] <-- looks strange for me, le me try 2011-02-05 18:34 it's all mentioned in K&R 2nd ed, appendix A ;-) 2011-02-05 18:36 It dint segfault 2011-02-05 18:36 uhm I didn't know xiangfu packaged offrss. Great. 2011-02-05 18:37 "offrss is a standalone program that can download your favorite feeds and then show them in your favorite Web browser" where is the www-browser?.. 2011-02-05 18:38 <3 newsbeuter (after several custom configs, tor one of then :-) ) 2011-02-05 18:38 what does  0["abc"]  do? Looks like some null pointer deref 2011-02-05 18:39 kristianpaul: lynx :) 2011-02-05 18:39 xMff: in C? 2011-02-05 18:39 viric: yes 2011-02-05 18:39 K&R is  the C programing language.... 2011-02-05 18:39 xMff: it translates to:        *(0 + "abc") 2011-02-05 18:39 But i dint get to Apendix A yet... 2011-02-05 18:39 ah, yeah 2011-02-05 18:40 where "abc" will be a pointer to somewhere 2011-02-05 18:40 but what address is "abc" ? I assume "random"... compiler & binary specific 2011-02-05 18:40 yes 2011-02-05 18:41 But I assume it will return 'a' 2011-02-05 18:41 Well, if '0' was taken as a char pointer, of course. 2011-02-05 18:41 If 'a' is 97 in hex it does 2011-02-05 18:42 crazy :) 2011-02-05 18:42 hm strange, that '0' is taken as a char pointer 2011-02-05 18:42 indeed 2011-02-05 18:42 isn't there any cast? Like ((char *) 0)["abc"] ? 2011-02-05 18:43 So, '0' looks like a char pointer. 2011-02-05 18:43 even -Wall does not say anything with gcc 2011-02-05 18:44 yeah... 2011-02-05 18:44 hmm wait 2011-02-05 18:45 valgrind !! 2011-02-05 18:45 ? 2011-02-05 18:46 if gcc takes '0' as a char pointer, there is nothing illegal in 0["abc"] 2011-02-05 18:46 hmm 2011-02-05 18:46 gotcha?! :-) 2011-02-05 18:46 1["abc"] will be 'b' 2011-02-05 18:47 you know that    *("abc") gives 'a', right? 2011-02-05 18:47 *("abc" + 0) too 2011-02-05 18:47 *("abc" + 1) gives 'b' 2011-02-05 18:47 so  0["abc"] == "abc"[0]  ? 2011-02-05 18:47 xMff: looks like so. Only because '0' is taken as char pointer. 2011-02-05 18:47 if it was taken as a pointer to anything else, it would not match 2011-02-05 18:48 interesting construct 2011-02-05 18:49 x[y] translates to *(y + x) 2011-02-05 18:49 Ah I only now realised that "abc" mandates the char pointer in the pointer arithmetic. It's not the 0, even it may say 0["abc"] 2011-02-05 18:50 all clear 2011-02-05 18:50 Bona nit 2011-02-05 18:50 noches 2011-02-05 18:56 hah!, even clang said something.. 2011-02-05 19:11 well it's valid c, why should it ;) 2011-02-05 19:11 as i said before x[y] is just eyecandy for *(x + y) 2011-02-05 19:11 is llvm !! ;-) 2011-02-05 19:34 viric: you got it ! the "[]" operator is commutative, just like "+". very logical - and very surprising when you run into it ;-) 2011-02-05 19:34 now go and write code that screws with people's heads :) 2011-02-05 19:34 kristianpaul: have you already figured out the n > -1 ? 2011-02-05 19:35 unsigned is stronger than signed 2011-02-05 19:37 larsc: that's a way of putting it. if one argument is unsigned, both will be converted to unsigned. so it becomes the equivalent of (unsigned) n > (unsigned) -1 2011-02-05 19:40 this is one of the useful things -Wextra reports 2011-02-05 20:00 wpwrak: 0