What does Borland mean by "Functions containing for are not expanded inline"?

This is a discussion on What does Borland mean by "Functions containing for are not expanded inline"? within the C++ Programming forums, part of the General Programming Boards category; Borland is giving me a warning for some reason. Not sure why?? Has anyone come across this warning before please? ...

  1. #1
    Registered User
    Join Date
    Sep 2010
    Location
    London
    Posts
    41

    What does Borland mean by "Functions containing for are not expanded inline"?

    Borland is giving me a warning for some reason. Not sure why??
    Has anyone come across this warning before please?
    "Functions containing for are not expanded inline"

    Here is part of my code with one of the for loops it seems to be complaining about:
    Code:
    class Neuron
    {
    public: 
    Neuron(unsigned int numI) 
    {
    neuronNumInputs = numI;
    for(unsigned int i=0; i<neuronNumInputs; i++) 
    {
    vecWeights.push_back(randWeight()); 
    }
    }
    double produceOutput(const vector<double>& inputs) 
    {
    assert(neuronNumInputs == inputs.size()); 
    double activation = 0;
    for(unsigned int i=0; i<inputs.size(); i++)
    {
    activation += vecWeights[i]*inputs[i];
    }
    double neuronOutput = 1/(1 + exp(-activation));
    return neuronOutput;
    }
    private: // Encapsulate variables
    unsigned int neuronNumInputs; 
    vector<double> vecWeights; 
    };
    Thank you!
    Last edited by Kat007; 09-05-2010 at 06:09 PM. Reason: Please help...

  2. #2
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587
    Sounds like functions containing for loops can't be inlined... idk.

  3. #3
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,765
    Since your are defining your constructor in the class body, it is implicitly marked as "inline". Apparently the compiler doesn't like functions with loops inlined.

    Now, there are two things you should do:
    1) INDENT!
    2) You are better off with a good compiler such as Visual C++ or GCC.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    Registered User
    Join Date
    Sep 2010
    Location
    London
    Posts
    41
    Thank you very much! I wasn't sure if I was doing something wrong. The the old Borland is a bit outdated lol

    TA!!!

Popular pages Recent additions subscribe to a feed

Tags for this Thread


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