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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/24/05 21:53
Read: times


 
#88394 - Stand corrected
Responding to: ???'s previous message
Andy Neil said:
Actually, in this case, the entire "HI %d" format string is stored in Code space. printf reads this and copies the "HI " bit into its buffer; it then does the "%d" formatting, and places the result in the buffer; it then makes calls to putchar to print the buffer


Then I stand corrected. Like I said, I've never dealt with modifying printf or putchar. In fact, I've never used printf on an 8052.

I'm surprised printf does it that way, though. It seems it could use a smaller buffer and be more efficient if the constant aspects of the formatting string were just output immediately and only formatted variables were stored temporarily in a working buffer prior to being sent out. Seems like copying the constant to a buffer and then later going back and sending it out all at once is an additional and unnecessary step. It also seems that that would put an artificial limitation on the length of a string that could be handled by printf when the only real limitation should (in my opinion) be on the length of the individual variable formatting; not on the overall string itself.

Regards,
Craig Steiner


List of 38 messages in thread
TopicAuthorDate
LCD<            01/01/70 00:00      
   must be a bug in lcd_write()            01/01/70 00:00      
      no bug            01/01/70 00:00      
      Bug in lcd_write            01/01/70 00:00      
         Another test            01/01/70 00:00      
         Not quite            01/01/70 00:00      
            Stand corrected            01/01/70 00:00      
               further corrected            01/01/70 00:00      
                  Makes sense            01/01/70 00:00      
                     Delay after the character write?            01/01/70 00:00      
                        unknown bug            01/01/70 00:00      
                           ANSI divergence            01/01/70 00:00      
                              Are you sure?            01/01/70 00:00      
                                 skdjfhg            01/01/70 00:00      
                                    It realy works fine with UART            01/01/70 00:00      
                                       Story so far            01/01/70 00:00      
   Keil and Function pointers?            01/01/70 00:00      
   Simulator            01/01/70 00:00      
      Kaiwalya - O.T            01/01/70 00:00      
         Let me try            01/01/70 00:00      
   Post the real code            01/01/70 00:00      
   Possibilities            01/01/70 00:00      
      ksfd            01/01/70 00:00      
         Troll            01/01/70 00:00      
            the real issue            01/01/70 00:00      
               Corrections            01/01/70 00:00      
               Small but fast            01/01/70 00:00      
                  MIPS            01/01/70 00:00      
            Corrections            01/01/70 00:00      
               sldkjf            01/01/70 00:00      
            dkfuhg            01/01/70 00:00      
               Corrections            01/01/70 00:00      
               Corrections            01/01/70 00:00      
                  got curious and looked            01/01/70 00:00      
               I'm wrong - Damn!            01/01/70 00:00      
                  debugging            01/01/70 00:00      
                     Post you real code            01/01/70 00:00      
   How to initilize 4X20 LCD            01/01/70 00:00      

Back to Subject List