Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Andy Peters
03/08/06 10:49
Read: 821 times
Tucson, Az
USA


 
#111633 - C vs assembler, take 655321
Responding to: Ian Bell's previous message
Ian Bell said:
Apart from the evaluation version not supporting floating point, this is a particularly bad piece of C code

1. variable a is an unsigned short yet it is assigned the result of pow() which returns a float or possibly a double (I forget which)
2. pow() expects floating point arguments but it is passed an unsigned short - it should be cast to float.

Yuk!!! Give me assembler any day.


Give me a programmer who is aware of things. (Insert old saw about "C" and "rope to hang yourself" here.) Years of VHDL and Verilog makes me aware of needing to cast types and not allow the compiler to promote and truncate things. (Yes, I'm paranoid, and I blame Verilog.)

3. This about the most inefficient way I can think of to raise a variable to a power of 2!!!


There's always programmer cleverness/laziness, which has nothing to do with the language ...

-a




List of 29 messages in thread
TopicAuthorDate
Keil C51 and Math      Laki Matt      02/25/06 15:00      
   Eval version?      Andy Neil      02/25/06 16:48      
      Not only but also      Ian Bell      02/26/06 03:40      
         Come now      Andy Neil      02/27/06 12:22      
            Come off it      Ian Bell      02/27/06 15:00      
               poorly typed      Erik Malund      03/03/06 07:58      
                  Typing (sic)      Ian Bell      03/03/06 09:41      
                     Ian      Erik Malund      03/06/06 08:42      
                        What type?      Ian Bell      03/06/06 15:31      
                           any decent compiler will give you a warn      Erik Malund      03/06/06 15:39      
                              it depends      Neil Kurzman      03/06/06 17:58      
                                 Get Promoted      Ian Bell      03/07/06 15:45      
                                    Too much promotion!      Andy Neil      03/08/06 01:43      
                                       Hells Bells      Ian Bell      03/08/06 06:33      
                                          Ding Dong!      Andy Neil      03/08/06 09:20      
         C vs assembler, take 655321      Andy Peters      03/08/06 10:49      
            anyone else will be a programmer in name      Erik Malund      03/08/06 11:01      
            Programmer laziness      Ian Bell      03/08/06 11:11      
   WebPage ?      Laki Matt      02/26/06 06:31      
      Much different      Steve M. Taylor      02/26/06 09:51      
         And Also      Neil Kurzman      02/27/06 12:49      
            Eh ?      Steve M. Taylor      02/27/06 12:55      
             C and C++      Andy Neil      02/27/06 14:13      
         Portable?      Andy Neil      02/27/06 14:11      
      handle your microprocessor functi      Erik Malund      02/27/06 07:36      
         Hm,      Laki Matt      02/27/06 12:41      
            Keil does it      Neil Kurzman      02/27/06 12:51      
               Floating point      Andy Neil      02/27/06 15:00      
                  Thanks,      Laki Matt      02/27/06 16:21      

Back to Subject List