Click here to Skip to main content
14,242,790 members

C / C++ / MFC

 
GeneralRe: MFC Picture Control image size. Pin
Maximilien18-Jul-19 3:50
memberMaximilien18-Jul-19 3:50 
GeneralRe: MFC Picture Control image size. Pin
Richard MacCutchan18-Jul-19 4:03
protectorRichard MacCutchan18-Jul-19 4:03 
QuestionAlgorithm Problem(C++ solution) Pin
nirvikprantor12-Jul-19 5:05
membernirvikprantor12-Jul-19 5:05 
AnswerRe: Algorithm Problem(C++ solution) PinPopular
OriginalGriff12-Jul-19 5:10
protectorOriginalGriff12-Jul-19 5:10 
GeneralRe: Algorithm Problem(C++ solution) Pin
Joe Woodbury12-Jul-19 10:02
professionalJoe Woodbury12-Jul-19 10:02 
AnswerRe: Algorithm Problem(C++ solution) Pin
Stefan_Lang15-Jul-19 2:05
memberStefan_Lang15-Jul-19 2:05 
AnswerRe: Algorithm Problem(C++ solution) Pin
Gerry Schmitz15-Jul-19 8:14
mveGerry Schmitz15-Jul-19 8:14 
QuestionOverflow check on integer multiplication in C ? Pin
Hans9999-Jul-19 2:01
memberHans9999-Jul-19 2: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 3:10
professionalDaniel Pfeffer9-Jul-19 3:10 
AnswerRe: Overflow check on integer multiplication in C ? Pin
Joe Woodbury9-Jul-19 7:41
professionalJoe Woodbury9-Jul-19 7:41 
AnswerRe: Overflow check on integer multiplication in C ? Pin
leon de boer10-Jul-19 3:35
memberleon de boer10-Jul-19 3:35 
GeneralRe: Overflow check on integer multiplication in C ? Pin
CPallini10-Jul-19 4:57
mveCPallini10-Jul-19 4: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 22:14
memberMember 143147593-Jul-19 22: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 2:39
memberleon de boer4-Jul-19 2:39 
Question"crosslinking " - different architecture libraries - is is possible? Pin
Vaclav_1-Jul-19 10:54
memberVaclav_1-Jul-19 10:54 
AnswerRe: "crosslinking " - different architecture libraries - is is possible? Pin
Richard MacCutchan1-Jul-19 20:56
protectorRichard MacCutchan1-Jul-19 20:56 
AnswerRe: "crosslinking " - different architecture libraries - is is possible? Pin
leon de boer2-Jul-19 5:03
memberleon de boer2-Jul-19 5:03 
QuestionCreated .Dll from and .ocx using C++/CLI but interop is not loading in C# Pin
Member 143147591-Jul-19 3:16
memberMember 143147591-Jul-19 3:16 
QuestionReturn From DoModal with RadioButton Pin
ForNow30-Jun-19 4:50
memberForNow30-Jun-19 4:50 
AnswerRe: Return From DoModal with RadioButton Pin
Victor Nijegorodov30-Jun-19 6:43
memberVictor Nijegorodov30-Jun-19 6:43 
AnswerRe: Return From DoModal with RadioButton Pin
Randor 30-Jun-19 7:13
professional Randor 30-Jun-19 7:13 
GeneralRe: Return From DoModal with RadioButton Pin
ForNow30-Jun-19 7:53
memberForNow30-Jun-19 7:53 
GeneralRe: Return From DoModal with RadioButton Pin
Randor 30-Jun-19 8:08
professional Randor 30-Jun-19 8:08 
GeneralRe: Return From DoModal with RadioButton Pin
ForNow30-Jun-19 9:43
memberForNow30-Jun-19 9:43 
PraiseRe: Return From DoModal with RadioButton Pin
Randor 30-Jun-19 14:22
professional Randor 30-Jun-19 14: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.