#qi-hardware IRC log for Saturday, 2011-02-05

rjeffrieshad 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.00:01
rjeffriesanybody around?00:40
zrafayes me.. but no for long01:05
rjeffriesJay7 where in Russia if I might ask?03:37
webpowerhi all07:14
webpowerwhat about USB 3?07:14
webpoweri must buy a new pc07:14
webpowerbut all the notebook have usb 207:15
kristianpaulC99 how i dint realized u existed before ;-) !15:33
rohwpwrak: your mail: what about hemp fibres?!!1! ;)17:37
roh*scnr* ... just kidding17:37
wpwrakroh: robust material, grows easily, bio-degradable, ... sounds perfect ;-)17:51
kristianpaulhttp://www.iso-9899.info/wiki/C_gotchas !!18:26
kristianpaulSo not fork even if rtems have posix support for it !!18:28
wpwrak(c gotchas) hah, tell me, will this segfault ?  printf("%d\n", 0["abc"]);18:30
wpwrak(c gotchas) unsigned n = 1; printf("%d\n", n > -1); /* true or false ? */18:30
kristianpaulwpwrak: You should write a book :-)18:32
kristianpaulOr is already somwhere and i dint realize it yet...18:32
kristianpaulhow you could try a signed operation with an unsigned variable?18:33
kristianpaul0["abc"] <-- looks strange for me, le me try18:34
wpwrakit's all mentioned in K&R 2nd ed, appendix A ;-)18:34
kristianpaulIt dint segfault18:36
viricuhm I didn't know xiangfu packaged offrss. Great.18:36
kristianpaul"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?..18:37
Action: kristianpaul <3 newsbeuter (after several custom configs, tor one of then :-) )18:38
xMffwhat does  0["abc"]  do? Looks like some null pointer deref18:38
virickristianpaul: lynx :)18:39
viricxMff: in C?18:39
xMffviric: yes18:39
kristianpaulK&R is  the C programing language....18:39
viricxMff: it translates to:        *(0 + "abc")18:39
kristianpaulBut i dint get to Apendix A yet...18:39
xMffah, yeah18:39
viricwhere "abc" will be a pointer to somewhere18:40
xMffbut what address is "abc" ? I assume "random"... compiler & binary specific18:40
viricBut I assume it will return 'a'18:41
viricWell, if '0' was taken as a char pointer, of course.18:41
kristianpaulIf 'a' is 97 in hex it does18:41
xMffcrazy :)18:42
virichm strange, that '0' is taken as a char pointer18:42
viricisn't there any cast? Like ((char *) 0)["abc"] ?18:42
viricSo, '0' looks like a char pointer.18:43
viriceven -Wall does not say anything with gcc18:43
kristianpaulhmm wait18:44
kristianpaulvalgrind !!18:45
viricif gcc takes '0' as a char pointer, there is nothing illegal in 0["abc"]18:46
kristianpaulgotcha?! :-)18:46
viric1["abc"] will be 'b'18:46
viricyou know that    *("abc") gives 'a', right?18:47
viric*("abc" + 0) too18:47
viric*("abc" + 1) gives 'b'18:47
xMffso  0["abc"] == "abc"[0]  ?18:47
viricxMff: looks like so. Only because '0' is taken as char pointer.18:47
viricif it was taken as a pointer to anything else, it would not match18:47
xMffinteresting construct18:48
larscx[y] translates to *(y + x)18:49
viricAh 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"]18:49
viricall clear18:50
viricBona nit18:50
kristianpaulhah!, even clang said something..18:56
larscwell it's valid c, why should it ;)19:11
larscas i said before x[y] is just eyecandy for *(x + y)19:11
kristianpaulis llvm !! ;-)19:11
wpwrakviric: you got it ! the "[]" operator is commutative, just like "+". very logical - and very surprising when you run into it ;-)19:34
wpwraknow go and write code that screws with people's heads :)19:34
wpwrakkristianpaul: have you already figured out the n > -1 ?19:34
larscunsigned is stronger than signed19:35
wpwraklarsc: 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) -119:37
wpwrakthis is one of the useful things -Wextra reports19:40
kristianpaulwpwrak: 020:00
--- Sun Feb 6 201100:00

Generated by irclog2html.py 2.9.2 by Marius Gedminas - find it at mg.pov.lt!