Like Tree2Likes
  • 2 Post By Salem

I want to exclude functions on compile time. Options?

This is a discussion on I want to exclude functions on compile time. Options? within the C Programming forums, part of the General Programming Boards category; Hi All. I am working on a project, where I have to be able to exclude some code fast and ...

  1. #1
    Registered User
    Join Date
    Mar 2013
    Posts
    1

    Lightbulb I want to exclude functions on compile time. Options?

    Hi All.

    I am working on a project, where I have to be able to exclude some code fast and dynamicly at compiletime.

    I got a scheduler running and actually I just want to remove some of the tasks from it - but at compile time so that the code wont take up space in my microcontroller.

    I know that I can use macros like #ifdef #endif etc. But I think that method makes the code unreadable and complicated.

    Any ideas how to archive such functionality a more elegant way?

    Thanks in advance
    Last edited by Jonas West Alrĝ; 03-06-2013 at 08:06 AM.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,671
    > I know that I can use macros like #ifdef #endif etc. But I think that method makes the code unreadable and complicated.
    Perhaps you should separate the code into multiple files then.

    If you
    - put one function in each source file
    - compile all the variant source files to produce a library
    - then link you configured scheduler with that library

    Then you will have only the code you need.
    Crossfire and dmh2000 like this.
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 01-12-2013, 09:11 AM
  2. Getting compile time.
    By ThatDudeMan in forum C Programming
    Replies: 2
    Last Post: 10-13-2010, 12:15 PM
  3. Replies: 2
    Last Post: 09-11-2007, 03:57 PM
  4. g++ compile options
    By cybernike in forum Linux Programming
    Replies: 2
    Last Post: 07-05-2007, 12:09 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21