Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 1549: change signature vs. inline

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
accord Posted - Apr 05 2007 : 08:13:57 AM
VAX 1549, VS2005 SP1, WinXP SP2, Unmanaged C++

in cpp:
inline void cTest::TestFunction(void)
{
    // some code
}

in header:
class cTest {
    // ...
    void TestFunction(void);
    // ...
};


If I use Change Signature on TestFunction (in cpp), then the inline will disappear.
If I know correctly, it is enough to put "inline" into the cpp.
12   L A T E S T    R E P L I E S    (Newest First)
bugfix Posted - Apr 07 2007 : 09:43:32 AM
quote:
Originally posted by Mike from reFX

Sorry, I'm doing cross platform development too and thus I don't always follow "Microsofts" way of doing things. Declaring methods inline outside the class declaration does not work for GCC 4.x (using it on OSX) etc.


huh? if that would be true you couldn't use e.g. boost on mac osx.
Mike from reFX Posted - Apr 07 2007 : 08:34:10 AM
Sorry, I'm doing cross platform development too and thus I don't always follow "Microsofts" way of doing things. Declaring methods inline outside the class declaration does not work for GCC 4.x (using it on OSX) etc.
feline Posted - Apr 05 2007 : 4:10:44 PM
I used to do cross platform development, targeting both UNIX and Windows via the C++ Qt library. This library uses Signals and Slots, via macro's and its own pre-processor, so it is "extending" the C++ language its self, via official C++ mechanisms (macros)

I used VAX all the time on this code base, as do other developers, and there is a FAQ about Qt. Making VAX work in the "real world" is important, what ever "real world" happens to mean. This is simply me being practical, since our customers want VAX to "just work"

Turning to the question of standards, there are all sorts of things in C++ that VAX does NOT handle 100% correctly. Nasty template code or complex macro's are the main source of these problems. Remember people want VAX to parse code in real time. They do not ask compilers to compile in real time. Plus we need to handle code as you are typing it - so it would never actually compile.

Where VAX diverges from the ISO standard, the Microsoft compiler, or some other "standard", e.g. a perfectly valid Qt class using signals and slots I view this as a bug to be addressed, since it is causing our customers problems. What their compiler of choice makes of the code... That I leave up to them.

Hopefully this helps a little bit.
accord Posted - Apr 05 2007 : 2:41:51 PM
OK, I was not exact.
If you do cross-platform development, you should adapt to Microsoft's AND other compilers at the same time (for example to GCC)
If there is significant different in a language feature between MS and GCC, you won't use this feature at all, but VAX can use.
Hopefully usually there is a solution that right for MS's compiler and other compilers also, and VAX should generate general code in these cases.
bugfix Posted - Apr 05 2007 : 2:24:32 PM
sorry.. but thats just BS. ever heard of cross platform development?
i already said. either is fine, inline can be used for function declarations and definitions.
accord Posted - Apr 05 2007 : 2:16:42 PM
quote:
Originally posted by bugfix

C++STANDARD-ISOIEC14882
thats THE standard and nothing else:)



Yes, this is the standard, but in my opinion VAX is based on a Microsoft product, so should adapt to Microsoft's implementation.
By the way can you tell me what this ISO says about inline? (Probably the same as MS's reference in this case)
bugfix Posted - Apr 05 2007 : 2:11:24 PM
C++STANDARD-ISOIEC14882
thats THE standard and nothing else:)
accord Posted - Apr 05 2007 : 2:08:49 PM
> I have seen some discussion about inline,
> and what the compiler will and will not do on this forum before.

I think Microsoft's "C++ Language Reference" can be a reference for a Microsoft Visual Studio plugin (VAX). What do you think? (my example is from there)
bugfix Posted - Apr 05 2007 : 1:53:02 PM
either usage is of inline is fine.

mike: your usage is just useless though, if the function definition is inside of class its automatically inline!
feline Posted - Apr 05 2007 : 1:51:39 PM
I have seen some discussion about inline, and what the compiler will and will not do on this forum before. Personally I am taking the very simple approach - the code compiles, so VA should not remove "inline"

case=5857
accord Posted - Apr 05 2007 : 09:40:02 AM
No. You are using implicit inline. Inline keyword is not neccessary in your case at all.
see http://msdn2.microsoft.com/en-us/library/z8y1yy88(VS.71).aspx
and example 1.

I've copied the following code from msdn (http://msdn2.microsoft.com/en-us/library/bw1hbe6y(VS.71).aspx)

// Inline_Member_Functions.cpp
class Account
{
public:
    Account(double initial_balance) { balance = initial_balance; }
    double GetBalance();
    double Deposit( double Amount );
    double Withdraw( double Amount );
private:
    double balance;
};

inline double Account::GetBalance()
{
    return balance;
}

inline double Account::Deposit( double Amount )
{
    return ( balance += Amount );
}

inline double Account::Withdraw( double Amount )
{
    return ( balance -= Amount );
}
int main()
{
}

As you can see, inline should be placed before definition and not before declaration.
Mike from reFX Posted - Apr 05 2007 : 09:06:03 AM
VAX is correct. The inline doesn't work in this case. It only works when it's directly within the class definition (in the .h file) like this:

class CTest {
    inline void TestFunction (void)
    {
        // do something
    }
};


© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000