Thread: What is this variable type????

  1. #1
    Registered User
    Join Date
    Jun 2012
    Posts
    21

    What is this variable type????

    Below is the code for a program I am modifying at work. EXT is just replaced by external each time it is used. u8 in this program is just an 8 bit unsigned variable. Does anybody know what the V in vu8 could be? It can't be volatile because volatile is used by using the word volatile through out the rest of the program? Any ideas what this data type represents???? Thanks much.

    Code:
    XT BIT auto_leveling_fg;
    
    
    EXT vu8 uart2_rx[UART2_RX_BUF_SIZE];
    EXT vu8 uart2_rx_index;
    EXT vu8 uart2_tx[UART2_TX_BUF_SIZE];
    EXT vu8 uart2_tx_index;
    EXT vu8 uart2_tx_size;
    EXT volatile BIT serial_cr_fg;						// set when carriage return ('\r') is received over serial port
    EXT BIT verbose_output;								// set/cleared by serial command. When reset, some serial notifications are not sent.
    
    
    EXT BIT dump_adc_data_fg;
    EXT BIT dump_hl_adc_volts;                          // fag used to tell system to print hilow adv val
    EXT BIT dump_button_data_fg;
    EXT BIT dump_go_data_fg;
    
    
    EXT u8 reset_sr;

  2. #2
    Registered User
    Join Date
    Jun 2012
    Posts
    21
    I should also not I have no idea why he is putting external before defining a function...??? external is already placed before functions implicitly. This is just redundant correct?

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > Does anybody know what the V in vu8 could be? It can't be volatile because volatile is used by using the word volatile through out the rest of the program?
    You know, you could just search all the header files for where vu8 is declared and actually find out the answer for yourself.
    But my guess is that it means volatile.

    The fact that it's spelled out elsewhere could just be down to a string of maintainers not knowing what some previous author was up to.


    >external is already placed before functions implicitly. This is just redundant correct?
    Yes.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Below is the code for a program I am modifying at work.
    Wouldn't the quickest and most reliable source of information at work be...other programmers with whom you're working? Or hell, search the source for the typedef?

  5. #5
    Registered User
    Join Date
    Jun 2012
    Posts
    21
    > Wouldn't the quickest and most reliable source of information at work be...other programmers with whom you're working? Or hell, search the source for the typedef?
    No, programmer is out of state at a new company. This program only has about 20K lines and was done by that one programmer.

    Salem- Thanks. I did not realize that vu8 was a typedef function, it is a volatile. I thought I was missing something that was standard in c, and had the impression that u8 was itself standard.

    Thanks for solving the simple question and taking your time. I am an intern and new to this stuff.

  6. #6
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    Quote Originally Posted by Daniel.Blesener View Post
    I thought I was missing something that was standard in c, and had the impression that u8 was itself standard.

    C99 (the standard developed back in 1999) did standardize some new types for integers, but they are of a different form, such as uint8_t, int16_t, etc (the standard short, int, long types only have guaranteed minimum ranges, but can be bigger). And you have to #include <stdint.h> to have access to them. Nearly all modern compilers support these types, so they are very standard. The only exception I can think of is MSVC++, and IIRC, Microsoft refuses to implement any C99 features. I think they do provide their own types of guaranteed size, just with slightly different names.

    Thanks for solving the simple question and taking your time. I am an intern and new to this stuff.
    Welcome to the fold. I hope you learn a lot from this internship. One thing I really hope you take away from this example is just how asinine it is to define abbreviations for basic C keywords (that are only ~8 characters long at the most). Not only is it utterly lazy, it does nothing but serve to confuse others (along with the syntax highlighting of many editors). You should always focus on writing clear, maintainable code that is easy for others to work with, and is easy for you to come back to and work with 6 months down the line.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 05-14-2011, 09:26 PM
  2. Variable-type variable?
    By Aidman in forum C++ Programming
    Replies: 13
    Last Post: 10-04-2003, 10:03 PM
  3. char variable type
    By Nectron in forum C++ Programming
    Replies: 3
    Last Post: 06-26-2003, 11:58 AM
  4. variable type declaration
    By threahdead in forum C Programming
    Replies: 4
    Last Post: 02-27-2003, 05:45 PM
  5. variable type char to variable type int
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 07-15-2002, 08:52 AM