C99 restrict and function parameters?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sune

    C99 restrict and function parameters?

    Hi,

    I'd like to know where to put my restrict qualifier for function
    parameters.

    I have to files:

    test.h and test.c

    In test.h I have the declaration:
    void test_func( int* p);

    and in test.c I have the definition:
    void test_func( int* p)
    {
    *p += 1;
    }

    For pointer p, do I have to put the restrict qualifier in test.h or
    test.c or both?

    BRs
    /Sune
  • santosh

    #2
    Re: C99 restrict and function parameters?

    Sune wrote:
    Hi,
    >
    I'd like to know where to put my restrict qualifier for function
    parameters.
    >
    I have to files:
    >
    test.h and test.c
    >
    In test.h I have the declaration:
    void test_func( int* p);
    >
    and in test.c I have the definition:
    void test_func( int* p)
    {
    *p += 1;
    }
    >
    For pointer p, do I have to put the restrict qualifier in test.h or
    test.c or both?
    Both. In the header it informs the user and in the implementation file
    it is obviously needed.

    Comment

    • ollemblomgren@gmail.com

      #3
      Re: C99 restrict and function parameters?

      On 15 Feb, 18:43, santosh <santosh....@gm ail.comwrote:
      Sune wrote:
      Hi,
      >
      I'd like to know where to put myrestrictquali fier for function
      parameters.
      >
      I have to files:
      >
      test.h and test.c
      >
      In test.h I have the declaration:
      void test_func( int* p);
      >
      and in test.c I have the definition:
      void test_func( int* p)
      {
         *p += 1;
      }
      >
      For pointer p, do I have to put therestrictqual ifier in test.h or
      test.c or both?
      >
      Both. In the header it informs the user and in the implementation file
      it is obviously needed.- Dölj citerad text -
      >
      - Visa citerad text -
      Ok, thanks!
      /Sune

      Comment

      Working...