Author Topic: sbit data type in mikro C pro  (Read 1003 times)

0 Members and 1 Guest are viewing this topic.

Offline khatusTopic starter

  • Regular Contributor
  • *
  • Posts: 154
  • Country: gl
sbit data type in mikro C pro
« on: July 25, 2019, 11:26:19 am »



What does it mean by " in a unit" ??
« Last Edit: July 25, 2019, 11:28:19 am by khatus »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13217
Re: sbit data type in mikro C pro
« Reply #1 on: July 25, 2019, 11:54:28 am »
A unit, colloquially compilation unit, but officially translation unit is one fully expanded C source file as seen by the compiler *AFTER* all preprocessing is complete. See https://en.wikipedia.org/wiki/Translation_unit_(programming)

N.B this has absolutely nothing to do with the MikroC propitiatory and non-standard sbit type or sfr qualifier except that a variable's definition and declaration using them apparently follow the same scope rules as any other C variable.
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 9336
  • Country: fi
Re: sbit data type in mikro C pro
« Reply #2 on: July 25, 2019, 11:55:52 am »
Unit is a compilation unit, basically the .c file where this line resides in. Declaring something in the unit with the extern keyword means that this unit (the c file), after this line, knows about the existence of such variable, and you can use it, but it is defined somewhere else.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf