Electronic Components Datasheet Search
  English  ▼
ALLDATASHEET.NET

X  

AN3350 Datasheet(PDF) 131 Page - STMicroelectronics

Part # AN3350
Description  eTPU compiler tools
PDF  185 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  STMICROELECTRONICS [STMicroelectronics]
Direct Link  http://www.st.com
Logo STMICROELECTRONICS - STMicroelectronics

AN3350 Datasheet(HTML) 131 Page - STMicroelectronics

Back Button AN3350 Datasheet HTML 127Page - STMicroelectronics AN3350 Datasheet HTML 128Page - STMicroelectronics AN3350 Datasheet HTML 129Page - STMicroelectronics AN3350 Datasheet HTML 130Page - STMicroelectronics AN3350 Datasheet HTML 131Page - STMicroelectronics AN3350 Datasheet HTML 132Page - STMicroelectronics AN3350 Datasheet HTML 133Page - STMicroelectronics AN3350 Datasheet HTML 134Page - STMicroelectronics AN3350 Datasheet HTML 135Page - STMicroelectronics Next Button
Zoom Inzoom in Zoom Outzoom out
 131 / 185 page
background image
AN3350
Pragmas for standard C conformance
Doc ID 018512 Rev 2
131/185
caused by referring to a function before you define it. For example, without a function
prototype, you might pass data of the wrong type. As a result, your code might not work as
you expect even though it compiles without error.
In Example 80, function main() calls PrintNum() with an integer argument even though
PrintNum()
takes an argument of type float.
Example 80 Unnoticed type-mismatch
#include <stdio.h>
void main(void)
{
PrintNum(1);
/* PrintNum() tries to interpret the
integer as a float. Prints 0.000000. */
}
void PrintNum(float x)
{
printf("%f\n", x);
}
When you run this program, you could get this result:
0.000000
Although the compiler does not complain about the type mismatch, the function does not
give the result you intended. Since PrintNum() does not have a prototype, the compiler
does not know to generate instructions to convert the integer to a floating-point number
before calling PrintNum(). Consequently, the function interprets the bits it received as a
floating-point number and prints nonsense.
A prototype for PrintNum(), as in Example 81, gives the compiler sufficient information
about the function to generate instructions to properly convert its argument to a floating-
point number. The function prints what you expected.
Example 81 Using a prototype to avoid type-mismatch
#include <stdio.h>
void PrintNum(float x); /* Function prototype. */
void main(void)
{
PrintNum(1);
/*
Compiler converts int to float.
}
Prints 1.000000. */
void PrintNum(float x)
{
printf("%f\n", x);
}
In other situations where automatic conversion is not possible, the compiler generates an
error message if an argument does not match the data type required by a function
prototype. Such a mismatched data type error is easier to locate at compile time than at
runtime.



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100  ...More


Datasheet Download

Go To PDF Page


Link URL



Does ALLDATASHEET help your business so far?  [ DONATE ] 

About Alldatasheet   |   Advertisement   |   Contact us   |   Privacy Policy   |   Link to Datasheet    |   Link Exchange   |   Manufacturer List
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com