Keil Logo

GENERAL: MISSING TYPE-SPECIFIER DOES NOT GENERATE ERROR


Information in this article applies to:

  • C166 Version 3.12
  • C166 Version 4.03
  • C251 Version 2.14
  • C51 Version 5.50

SYMPTOMS

I have declared some global variables as follows:

char var0 = 0; var1 = 1, var2 = 2, var3 = 3;

I typed a semicolon instead of a comma by mistake. The compiler did not generate an error and the variables were incorrectly initialized. Why?

CAUSE

By inserting a semicolon you have split your single variable declaration into two. The second being:

var1 = 1, var2 = 2, var3 = 3;

Because there is no type-specifer such as char then int is assumed. The variables are initialized correctly, but as ints.

MORE INFORMATION

Refer to section A8.2 Type Specifiers in The C Programming Language by Brian Kernighan and Dennis Ritchie.

Last Reviewed: Tuesday, July 19, 2005


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.