<div dir="ltr">so it is rtems build requirement?<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 27, 2019 at 2:53 AM Mr. Andrei Chichak <<a href="mailto:groups@chichak.ca">groups@chichak.ca</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;">Assume that you are using C and C has a facility to bind together object modules from different files.<div><br></div><div>You define a function in one file, it has a bunch of parameters and doesn’t return anything.</div><div><br></div><div>In another file you use that function but don’t have a prototype that tells the compiler anything about the function.</div><div><br></div><div>Now assume that the compiler was written in 1972, and doesn’t benefit from things like mind reading.</div><div><br></div><div>C assumes, by default, that <b style="font-size:14px">a function has one integer parameter and returns an integer, unless otherwise told</b>. What other choices has it got? Nothing really. </div><div><br></div><div>So in later versions of C, they introduced a thing called a prototype that gives the compiler a hint about the parameters and return values of a function.</div><div><br></div><div>All that you needed was to take your function header, put a semicolon on the end and paste it before the call to the function and the compiler would have done what you wanted instead of what you said.</div><div><br></div><div>Better yet, take that prototype and put it into a header file and whenever you want to call the function, put in an include statement, the compiler get’s the information about the parameters and return values, and overrides the<font face="Times"> <b>int func( int)</b></font> default nature.</div><div><br></div><div>A<br><div><br><blockquote type="cite"><div>On 2019-June-26, at 12:41 AM, Jython <<a href="mailto:googcheng@gmail.com" target="_blank">googcheng@gmail.com</a>> wrote:</div><br class="gmail-m_-5142158367025035996Apple-interchange-newline"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>I have a function named 
<b>oled_write_temp</b>

 in a.c, if i dont declare it in a.h , then i will get the wrong 
supply value in the function within main call, why?</div><div><br></div><div>if i 
declare it in a.h, then all is right<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>void oled_write_temp(float set_temp, const float supply, float return_temp)<br>{<br><br>    int base_x = 12, base_y = 60;<br><br>    char buffer[20] = {0};<br><br>    <b>printf("supply_temp %f at %s\n", supply, __FUNCTION__);</b><br>    <br>    snprintf(buffer, 20, "SUPPLY:%.2f", supply);<br>    printf("supply_temp string %s\n", buffer);<br><br>    oled_clear_area(base_x, base_y + 16, 122, base_y + 32);<br>    OLED_ShowString(base_x, base_y + 16, buffer, 16, 1);<br><br>    memset(buffer, 0, sizeof(buffer));<br>    snprintf(buffer, 20, "RETURN:%.2f", return_temp);<br>    OLED_ShowString(base_x, base_y + 36, buffer, 16, 1);<br><br>    memset(buffer, 0, sizeof(buffer));<br>    snprintf(buffer, 20, "SET   :%.2f", set_temp);<br>    OLED_ShowString(base_x, base_y + 56, buffer, 16, 1);<br><br>}<br></div></blockquote><div><br></div><div>ps: watch line 
<b>printf("supply_temp %f at %s\n", supply, __FUNCTION__);</b>

 </div></div></div></div>
_______________________________________________<br>users mailing list<br><a href="mailto:users@rtems.org" target="_blank">users@rtems.org</a><br><a href="http://lists.rtems.org/mailman/listinfo/users" target="_blank">http://lists.rtems.org/mailman/listinfo/users</a></div></blockquote></div><br>
<br></div></div></blockquote></div>