| rjeffries | 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. | 00:01 |
|---|---|---|
| rjeffries | s/exicting/exciting | 00:02 |
| rjeffries | anybody around? | 00:40 |
| zrafa | yes me.. but no for long | 01:05 |
| rjeffries | hi | 01:23 |
| rjeffries | Jay7 where in Russia if I might ask? | 03:37 |
| webpower | hi all | 07:14 |
| webpower | what about USB 3? | 07:14 |
| webpower | i must buy a new pc | 07:14 |
| webpower | but all the notebook have usb 2 | 07:15 |
| kristianpaul | C99 how i dint realized u existed before ;-) ! | 15:33 |
| wpwrak | ;-) | 15:44 |
| roh | wpwrak: your mail: what about hemp fibres?!!1! ;) | 17:37 |
| roh | *scnr* ... just kidding | 17:37 |
| wpwrak | roh: robust material, grows easily, bio-degradable, ... sounds perfect ;-) | 17:51 |
| kristianpaul | http://www.iso-9899.info/wiki/C_gotchas !! | 18:26 |
| kristianpaul | So 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 |
| kristianpaul | wpwrak: You should write a book :-) | 18:32 |
| kristianpaul | Or is already somwhere and i dint realize it yet... | 18:32 |
| kristianpaul | how you could try a signed operation with an unsigned variable? | 18:33 |
| kristianpaul | 0["abc"] <-- looks strange for me, le me try | 18:34 |
| wpwrak | it's all mentioned in K&R 2nd ed, appendix A ;-) | 18:34 |
| kristianpaul | It dint segfault | 18:36 |
| viric | uhm 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 | |
| xMff | what does 0["abc"] do? Looks like some null pointer deref | 18:38 |
| viric | kristianpaul: lynx :) | 18:39 |
| viric | xMff: in C? | 18:39 |
| xMff | viric: yes | 18:39 |
| kristianpaul | K&R is the C programing language.... | 18:39 |
| viric | xMff: it translates to: *(0 + "abc") | 18:39 |
| kristianpaul | But i dint get to Apendix A yet... | 18:39 |
| xMff | ah, yeah | 18:39 |
| viric | where "abc" will be a pointer to somewhere | 18:40 |
| xMff | but what address is "abc" ? I assume "random"... compiler & binary specific | 18:40 |
| viric | yes | 18:40 |
| viric | But I assume it will return 'a' | 18:41 |
| viric | Well, if '0' was taken as a char pointer, of course. | 18:41 |
| kristianpaul | If 'a' is 97 in hex it does | 18:41 |
| xMff | crazy :) | 18:42 |
| viric | hm strange, that '0' is taken as a char pointer | 18:42 |
| kristianpaul | indeed | 18:42 |
| viric | isn't there any cast? Like ((char *) 0)["abc"] ? | 18:42 |
| viric | So, '0' looks like a char pointer. | 18:43 |
| viric | even -Wall does not say anything with gcc | 18:43 |
| kristianpaul | yeah... | 18:44 |
| kristianpaul | hmm wait | 18:44 |
| kristianpaul | valgrind !! | 18:45 |
| viric | ? | 18:45 |
| viric | if gcc takes '0' as a char pointer, there is nothing illegal in 0["abc"] | 18:46 |
| kristianpaul | hmm | 18:46 |
| kristianpaul | gotcha?! :-) | 18:46 |
| viric | 1["abc"] will be 'b' | 18:46 |
| viric | you know that *("abc") gives 'a', right? | 18:47 |
| viric | *("abc" + 0) too | 18:47 |
| viric | *("abc" + 1) gives 'b' | 18:47 |
| xMff | so 0["abc"] == "abc"[0] ? | 18:47 |
| viric | xMff: looks like so. Only because '0' is taken as char pointer. | 18:47 |
| viric | if it was taken as a pointer to anything else, it would not match | 18:47 |
| xMff | interesting construct | 18:48 |
| larsc | x[y] translates to *(y + x) | 18:49 |
| viric | 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"] | 18:49 |
| viric | all clear | 18:50 |
| viric | Bona nit | 18:50 |
| kristianpaul | noches | 18:50 |
| kristianpaul | hah!, even clang said something.. | 18:56 |
| larsc | well it's valid c, why should it ;) | 19:11 |
| larsc | as i said before x[y] is just eyecandy for *(x + y) | 19:11 |
| kristianpaul | is llvm !! ;-) | 19:11 |
| wpwrak | viric: you got it ! the "[]" operator is commutative, just like "+". very logical - and very surprising when you run into it ;-) | 19:34 |
| wpwrak | now go and write code that screws with people's heads :) | 19:34 |
| wpwrak | kristianpaul: have you already figured out the n > -1 ? | 19:34 |
| larsc | unsigned is stronger than signed | 19:35 |
| wpwrak | 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 | 19:37 |
| wpwrak | this is one of the useful things -Wextra reports | 19:40 |
| kristianpaul | wpwrak: 0 | 20:00 |
| --- Sun Feb 6 2011 | 00:00 | |
Generated by irclog2html.py 2.9.2 by Marius Gedminas - find it at mg.pov.lt!