Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Thomas Boell <tboell@domain.invalid> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); |
| Date | 2011-07-29 14:38 +0200 |
| Organization | albasani.net |
| Message-ID | <20110729143830.3be0d200@arcadia> (permalink) |
| References | <4e291da0$0$26840$426a34cc@news.free.fr> <j0bijd$a3r$1@dont-email.me> <4e2984f9$0$16410$426a74cc@news.free.fr> <537389fd-0c86-45fb-9add-25f1c3dacc20@fq4g2000vbb.googlegroups.com> |
On Fri, 22 Jul 2011 08:14:44 -0700 (PDT) "Kleuskes & Moos" <kleuske@xs4all.nl> wrote: > On Jul 22, 4:11 pm, Francois Grieu <fgr...@gmail.com> wrote: > [..] > > If I rationalize: on low-end platforms (PIC..) that I often use, RAM > > size is a few hundred bytes and program space a few kbytes, so every > > byte counts. Even on relatively powerful CPUs (Arm, x86) and when memory > > is not an issue, using one more register may force the shift of > > something into memory rather than in a register, or/and a little extra > > code could abruptly reduce cache efficiency, and in turn slow down > > things considerably. I bet I could construct an articial demo where the > > suggested change increases execution time/power draw quite perceptibly, > > say by 30%. > > > > Francois Grieu > > If such finegrained control is needed, wouldn't you be better off > using assembly? Most uC targeted compilers i know of mix the two quite > well. > > From what i read portability isn't a great concern, since you're quite > specific on the platform, so that can't be the issue. Have you ever used assembly on a microcontroller? Many of the widely-used Atmel uCs, for example, don't have a multiply instruction. They cannot do calculations on any integers larger than 8 bits directly. There is no "add immediate" instruction either; you have to negate the value and use "subtract immediate" instead. Letting the compiler handle things like 16-bit multiplication certainly makes things a lot easier. Programming uCs in assembly is hard, error-prone, and the code will not be easy to maintain. If anyone says they would rather program uCs in C, they certainly have a point.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Francois Grieu <fgrieu@gmail.com> - 2011-07-22 08:49 +0200
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-07-22 00:58 -0700
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); gwowen <gwowen@gmail.com> - 2011-07-22 01:46 -0700
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); gazelle@shell.xmission.com (Kenny McCormack) - 2011-07-22 13:16 +0000
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-07-22 06:35 -0700
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); tom st denis <tom@iahu.ca> - 2011-07-22 08:37 -0700
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Kenneth Brody <kenbrody@spamcop.net> - 2011-07-22 12:20 -0400
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Francois Grieu <fgrieu@gmail.com> - 2011-07-22 16:41 +0200
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Kenneth Brody <kenbrody@spamcop.net> - 2011-07-22 12:10 -0400
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-07-22 19:39 +0100
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); luser- -droog <mijoryx@yahoo.com> - 2011-07-22 21:05 -0700
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-07-23 13:24 +0100
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); gazelle@shell.xmission.com (Kenny McCormack) - 2011-07-23 15:11 +0000
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); "io_x" <a@b.c.invalid> - 2011-07-23 22:16 +0200
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Keith Thompson <kst-u@mib.org> - 2011-07-22 09:39 -0700
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-07-22 22:30 +0300
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Keith Thompson <kst-u@mib.org> - 2011-07-22 13:15 -0700
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-07-23 01:02 +0300
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Jens Schweikhardt <usenet@schweikhardt.net> - 2011-07-23 13:06 +0000
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-07-23 16:51 +0300
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Kenneth Brody <kenbrody@spamcop.net> - 2011-07-25 12:06 -0400
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Jens Schweikhardt <usenet@schweikhardt.net> - 2011-07-25 20:39 +0000
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Kenneth Brody <kenbrody@spamcop.net> - 2011-07-26 10:43 -0400
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Keith Thompson <kst-u@mib.org> - 2011-07-26 08:58 -0700
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Kenneth Brody <kenbrody@spamcop.net> - 2011-07-25 12:03 -0400
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-07-29 01:51 +0300
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); August Karlstrom <fusionfile@gmail.com> - 2011-07-22 12:15 +0200
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Francois Grieu <fgrieu@gmail.com> - 2011-07-22 16:11 +0200
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-07-22 08:14 -0700
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Thomas Boell <tboell@domain.invalid> - 2011-07-29 14:38 +0200
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); James Kuyper <jameskuyper@verizon.net> - 2011-07-29 09:23 -0400
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Thomas Boell <tboell@domain.invalid> - 2011-07-29 15:58 +0200
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); James Kuyper <jameskuyper@verizon.net> - 2011-07-29 10:42 -0400
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Willem <willem@toad.stack.nl> - 2011-07-29 14:56 +0000
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); James Kuyper <jameskuyper@verizon.net> - 2011-07-29 20:47 -0400
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Willem <willem@toad.stack.nl> - 2011-07-30 09:12 +0000
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); James Kuyper <jameskuyper@verizon.net> - 2011-07-30 07:30 -0400
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Thomas Boell <tboell@domain.invalid> - 2011-07-29 17:08 +0200
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Ali <abdulrazaq@gmail.com> - 2011-07-29 08:21 -0700
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Kenneth Brody <kenbrody@spamcop.net> - 2011-07-22 12:24 -0400
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Francois Grieu <fgrieu@gmail.com> - 2011-07-25 10:34 +0200
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Willem <willem@toad.stack.nl> - 2011-07-25 08:54 +0000
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Keith Thompson <kst-u@mib.org> - 2011-07-25 09:08 -0700
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Willem <willem@toad.stack.nl> - 2011-07-25 16:52 +0000
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Keith Thompson <kst-u@mib.org> - 2011-07-25 11:37 -0700
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); cri@tiac.net (Richard Harter) - 2011-07-25 20:16 +0000
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Francois Grieu <fgrieu@gmail.com> - 2011-07-26 10:23 +0200
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-07-26 00:49 -0700
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); "io_x" <a@b.c.invalid> - 2011-07-26 11:16 +0200
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-07-26 03:09 -0700
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); "io_x" <a@b.c.invalid> - 2011-07-26 19:21 +0200
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-07-27 00:43 -0700
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); "io_x" <a@b.c.invalid> - 2011-07-27 11:29 +0200
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Keith Thompson <kst-u@mib.org> - 2011-07-27 08:30 -0700
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Kenneth Brody <kenbrody@spamcop.net> - 2011-07-26 10:39 -0400
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Hallvard B Furuseth <h.b.furuseth@usit.uio.no> - 2011-07-26 12:37 +0200
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Francois Grieu <fgrieu@gmail.com> - 2011-07-26 12:52 +0200
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Hallvard B Furuseth <h.b.furuseth@usit.uio.no> - 2011-07-26 13:18 +0200
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Keith Thompson <kst-u@mib.org> - 2011-07-26 08:57 -0700
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Hallvard B Furuseth <h.b.furuseth@usit.uio.no> - 2011-07-27 10:18 +0200
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Ali <abdulrazaq@gmail.com> - 2011-07-23 15:38 -0700
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Ali <abdulrazaq@gmail.com> - 2011-07-24 09:25 -0700
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-07-26 01:01 -0700
Re: do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); gwowen <gwowen@gmail.com> - 2011-07-25 03:08 -0700
csiph-web