bugAVR C Runtime Library - Bugs: bug #49447, Example code for uart_putchar()...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #49447: Example code for uart_putchar() has error in recursive call

Submitter:  Norman Dunbar <normandunbar>
Submitted:  Wed 26 Oct 2016 11:57:57 AM UTC
   
 
Category:  Documentation Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Documentation
Status:  Fixed Assigned to:  joerg_wunsch
Percent Complete:  0% Open/Closed:  Closed
Release:  2.0.0 Fixed Release:  2.0.1

Thu 27 Oct 2016 10:21:56 PM UTC, comment #2: 

No worries. Thanks for all the hard work.

Cheers,
Norm.

Norman Dunbar <normandunbar>
Thu 27 Oct 2016 08:42:10 PM UTC, comment #1: 

Thanks for catching this.  Fixing it was simple. ;-)

Joerg Wunsch <joerg_wunsch>
Group administrator
Wed 26 Oct 2016 11:57:57 AM UTC, original submission:  

Good Afternoon All,

I have checked the bug database for anything relating to uart_putchar() and found two references that do not cover the following.

In the example code given in Note 2 for "Running stdio without malloc()" in the section covering the "<stdio.h>" header features, the recursive call to uart_putchar() is missing the second "stream" parameter.

The example given is:


int
uart_putchar(char c, FILE *stream)
{
  if (c == '\n')
    uart_putchar('\r');
  loop_until_bit_is_set(UCSRA, UDRE);
  UDR = c;
  return 0;
}


And I'm sure it should be:


int
uart_putchar(char c, FILE *stream)
{
  if (c == '\n')
    uart_putchar('\r', stream);
    ...
}


The example given just prior to the above section is correct in that it does pass the second parameter.

Cheers,
Norm.

Norman Dunbar <normandunbar>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by joerg_wunsch (Posted a comment)
  • -email is unavailable- added by normandunbar (Submitted the item)
  •  

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-10-27 joerg_wunsch StatusNone Fixed
        Assigned toNone joerg_wunsch
        Open/ClosedOpen Closed
        Fixed ReleaseNone 2.0.1

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code