Click here to Skip to main content
15,793,139 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: MFC Picture Control image size. Pin
Maximilien18-Jul-19 4:50
Maximilien18-Jul-19 4:50 
GeneralRe: MFC Picture Control image size. Pin
Richard MacCutchan18-Jul-19 5:03
mveRichard MacCutchan18-Jul-19 5:03 
QuestionAlgorithm Problem(C++ solution) Pin
nirvikprantor12-Jul-19 6:05
nirvikprantor12-Jul-19 6:05 
AnswerRe: Algorithm Problem(C++ solution) Pin
OriginalGriff12-Jul-19 6:10
mvaOriginalGriff12-Jul-19 6:10 
GeneralRe: Algorithm Problem(C++ solution) Pin
Joe Woodbury12-Jul-19 11:02
professionalJoe Woodbury12-Jul-19 11:02 
AnswerRe: Algorithm Problem(C++ solution) Pin
Stefan_Lang15-Jul-19 3:05
Stefan_Lang15-Jul-19 3:05 
AnswerRe: Algorithm Problem(C++ solution) Pin
Gerry Schmitz15-Jul-19 9:14
mveGerry Schmitz15-Jul-19 9:14 
QuestionOverflow check on integer multiplication in C ? Pin
Hans9999-Jul-19 3:01
Hans9999-Jul-19 3:01 
Hello,

I need to multiply integer value with a factor and want to do an overflow check with INT_MAX, INT_MIN for this.

Integer contains 4 bytes on my machine an this is the max variable-size.
I need to do this check for signed integer and unsigned integer. Only integer math/variables allowed.

The factor always comes as fraction with a nominator and denominator. The denominator always is 10
Factor might be greater 1 or less than 1

So for example fraction is 25/10, varible a is signed integer

a = (a * 25)/10 -> may cause overflow, because (a * 25) can be > INT_MAX ( or < INT_MIN )

Overflow checks:
if (a > (INT_MAX * 10)/25 -> not possible because of overflow, INT_MAX is the maximum number the compiler can store.
if (a > INT_MAX * (10/25) -> not possible because 10/25 is 0.4 which will be 0 in integer math.

So any idea how to solve my problem?

Thanks for any hint!

AnswerRe: Overflow check on integer multiplication in C ? Pin
Daniel Pfeffer9-Jul-19 4:10
professionalDaniel Pfeffer9-Jul-19 4:10 
AnswerRe: Overflow check on integer multiplication in C ? Pin
Joe Woodbury9-Jul-19 8:41
professionalJoe Woodbury9-Jul-19 8:41 
AnswerRe: Overflow check on integer multiplication in C ? Pin
leon de boer10-Jul-19 4:35
leon de boer10-Jul-19 4:35 
GeneralRe: Overflow check on integer multiplication in C ? Pin
CPallini10-Jul-19 5:57
mveCPallini10-Jul-19 5:57 
SuggestionI have created a Wrapper but while calling a function from C# its moving to my Lib file and giving below error andy solution? Pin
Member 143147593-Jul-19 23:14
Member 143147593-Jul-19 23:14 
GeneralRe: I have created a Wrapper but while calling a function from C# its moving to my Lib file and giving below error andy solution? Pin
leon de boer4-Jul-19 3:39
leon de boer4-Jul-19 3:39 
Question"crosslinking " - different architecture libraries - is is possible? Pin
Vaclav_1-Jul-19 11:54
Vaclav_1-Jul-19 11:54 
AnswerRe: "crosslinking " - different architecture libraries - is is possible? Pin
Richard MacCutchan1-Jul-19 21:56
mveRichard MacCutchan1-Jul-19 21:56 
AnswerRe: "crosslinking " - different architecture libraries - is is possible? Pin
leon de boer2-Jul-19 6:03
leon de boer2-Jul-19 6:03 
QuestionCreated .Dll from and .ocx using C++/CLI but interop is not loading in C# Pin
Member 143147591-Jul-19 4:16
Member 143147591-Jul-19 4:16 
QuestionReturn From DoModal with RadioButton Pin
ForNow30-Jun-19 5:50
ForNow30-Jun-19 5:50 
AnswerRe: Return From DoModal with RadioButton Pin
Victor Nijegorodov30-Jun-19 7:43
Victor Nijegorodov30-Jun-19 7:43 
AnswerRe: Return From DoModal with RadioButton Pin
Randor 30-Jun-19 8:13
professional Randor 30-Jun-19 8:13 
GeneralRe: Return From DoModal with RadioButton Pin
ForNow30-Jun-19 8:53
ForNow30-Jun-19 8:53 
GeneralRe: Return From DoModal with RadioButton Pin
Randor 30-Jun-19 9:08
professional Randor 30-Jun-19 9:08 
GeneralRe: Return From DoModal with RadioButton Pin
ForNow30-Jun-19 10:43
ForNow30-Jun-19 10:43 
PraiseRe: Return From DoModal with RadioButton Pin
Randor 30-Jun-19 15:22
professional Randor 30-Jun-19 15:22 

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.