Results 1 to 3 of 3

Thread: C++ keyword search for the functions

  1. #1
    Join Date
    May 2008
    Posts
    33

    C++ keyword search for the functions

    a few months ago I read something ABOUT a certain key word that I can not find.

    The principle was that if a function depends solely on its parameters (not rand, or dependence on time or on a variable-volatile), the compiler could save the result in memory to optimize the next call.

    Code:
    int foo (int a)
    (
    return a + 2;
    )
    void main ()
    (
    foo (5);
    foo (5);
    )
    foo here would be called once the 2nd time and the result is already in memory.
    In my memory function was called 'pure' but looking on this key word I do not think 'pure virtual' ...

  2. #2
    Join Date
    May 2008
    Posts
    115

    Re: C++ keyword search for the functions

    You can wrap each attribute in a macro and vary according to the macro compilos.

  3. #3
    Join Date
    May 2008
    Posts
    3

    Re: C++ keyword search for the functions

    Under gcc you __attribute__ ((pure)) and __attribute__ ((const)), but otherwise nothing portable.
    You can wrap each attribute in a macro and vary according to the macro compilos.

Similar Threads

  1. Replies: 4
    Last Post: 19-04-2011, 10:55 AM
  2. ISP’S DNS not giving a proper keyword search in Firefox
    By Shaktiman in forum Technology & Internet
    Replies: 5
    Last Post: 19-04-2011, 10:53 AM
  3. Need to know about search engine and Keyword marketing.
    By Akaashath in forum Technology & Internet
    Replies: 5
    Last Post: 11-03-2010, 12:06 AM
  4. Replies: 2
    Last Post: 27-06-2009, 01:15 PM
  5. Replies: 3
    Last Post: 09-01-2009, 01:38 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,751,351,810.96571 seconds with 16 queries