Click here to Skip to main content
15,919,613 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C++ Where to start? Pin
David Crow3-Nov-05 3:42
David Crow3-Nov-05 3:42 
GeneralRe: C++ Where to start? Pin
Kevin McFarlane3-Nov-05 8:49
Kevin McFarlane3-Nov-05 8:49 
AnswerRe: C++ Where to start? Pin
Bob Stanneveld2-Nov-05 7:52
Bob Stanneveld2-Nov-05 7:52 
GeneralRe: C++ Where to start? Pin
Leather992-Nov-05 22:06
Leather992-Nov-05 22:06 
GeneralRe: C++ Where to start? Pin
Kevin McFarlane3-Nov-05 8:57
Kevin McFarlane3-Nov-05 8:57 
AnswerRe: C++ Where to start? Pin
Kevin McFarlane2-Nov-05 9:31
Kevin McFarlane2-Nov-05 9:31 
GeneralRe: C++ Where to start? Pin
Leather992-Nov-05 22:09
Leather992-Nov-05 22:09 
Questionfriend,static,inline,.. recommendation Pin
ddmcr2-Nov-05 4:02
ddmcr2-Nov-05 4:02 
Hello guys,
I have next situation : I have a class CHugeInteger , which has four public functions :

1) CString add(CString &a,CString &b)
2) CString sub(CString &a,CString &b)
3) CString mul(String &a,CString &b)
4) CString div(CString &a,CString &b)

I also have two(or more) protected member functions : foo1(..),foo2(..),...;

The later four public functions I need for doing arithmetic operations on very large numbers.

The protected functions are called by public functions very many times,especially when I am doing arithmetic operations with very big numbers(more than 500 digits).

Also public functions call each other very many times , for example div calls add ,sub and mul .

My questions is : what is the best way in this case to declare these functions(static,friend,inline,global..) in order to get best performance ?

My first implementation looked like this :

-The four public functions(add,mul,div,sub) were declared as friend functions.
-All protected members as static.

So the class's user interface was also easy to use as the client could call the functions straight like :

CString s = mul("23423423498989898877234234","4568988590866085685686805680")

but the user interface is not important for me.And I thought that latter implementation was not the best way of declaring functions for getting highest performance.



Can anyone help??

thanks



"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill


AnswerRe: friend,static,inline,.. recommendation Pin
Maximilien2-Nov-05 4:59
Maximilien2-Nov-05 4:59 
GeneralRe: friend,static,inline,.. recommendation Pin
ddmcr2-Nov-05 5:19
ddmcr2-Nov-05 5:19 
GeneralRe: friend,static,inline,.. recommendation Pin
Maximilien2-Nov-05 5:32
Maximilien2-Nov-05 5:32 
GeneralRe: friend,static,inline,.. recommendation Pin
ddmcr2-Nov-05 5:42
ddmcr2-Nov-05 5:42 
GeneralRe: friend,static,inline,.. recommendation Pin
toxcct2-Nov-05 5:47
toxcct2-Nov-05 5:47 
AnswerRe: friend,static,inline,.. recommendation [edited] Pin
toxcct2-Nov-05 5:01
toxcct2-Nov-05 5:01 
GeneralRe: friend,static,inline,.. recommendation Pin
ddmcr2-Nov-05 5:24
ddmcr2-Nov-05 5:24 
GeneralRe: friend,static,inline,.. recommendation Pin
toxcct2-Nov-05 5:30
toxcct2-Nov-05 5:30 
GeneralRe: friend,static,inline,.. recommendation Pin
ddmcr2-Nov-05 5:47
ddmcr2-Nov-05 5:47 
AnswerRe: friend,static,inline,.. recommendation Pin
S. Senthil Kumar2-Nov-05 5:04
S. Senthil Kumar2-Nov-05 5:04 
GeneralRe: friend,static,inline,.. recommendation Pin
ddmcr2-Nov-05 5:17
ddmcr2-Nov-05 5:17 
GeneralRe: friend,static,inline,.. recommendation Pin
David Crow2-Nov-05 6:15
David Crow2-Nov-05 6:15 
GeneralRe: friend,static,inline,.. recommendation Pin
ddmcr2-Nov-05 6:44
ddmcr2-Nov-05 6:44 
GeneralRe: friend,static,inline,.. recommendation Pin
toxcct2-Nov-05 6:49
toxcct2-Nov-05 6:49 
GeneralRe: friend,static,inline,.. recommendation Pin
ddmcr2-Nov-05 7:12
ddmcr2-Nov-05 7:12 
GeneralRe: friend,static,inline,.. recommendation Pin
toxcct2-Nov-05 20:43
toxcct2-Nov-05 20:43 
GeneralRe: friend,static,inline,.. recommendation Pin
ddmcr2-Nov-05 21:28
ddmcr2-Nov-05 21:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.