C queries

Discussion in 'General Electronics Chat' started by aamirali, Oct 30, 2012.

  1. aamirali

    Thread Starter Member

    Feb 2, 2012
    1. Can I use const + static keyword. In one of file I have constant & if they are defined as static also will they be available to that file only.

    2. I have confusing regarding typedef statement in function pointer. Can someone elaborate.

    3. If in code of multiple files, if I define function to be static in one file, will compiler try to make it inline.
    I am using keil + Op-03, op for time.
  2. WBahn


    Mar 31, 2012
    In general, play with it and see.

    I always felt that the use of the keyword "static" to mean different things in different contexts was unfortunate. They should have simply used some other term.

    In your first question, you don't indicate if you are talking about a function or a variable.

    I can't figure out what you are talking about with your second question.

    The compiler is generally free to inline or not inline any function as it sees fit. Using the keyword 'inline' is a hint to the compiler that it might want to inline that particular function, but the compiler seldom can do this unless it knows that the function is not used in any other translation unit, declaring the function to be static provides this assurance.