Click here to Skip to main content
15,918,003 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Pause Pin
JeabJB13-Apr-04 4:17
JeabJB13-Apr-04 4:17 
GeneralSet icon in CDialog Pin
anderslundsgard13-Apr-04 2:08
anderslundsgard13-Apr-04 2:08 
GeneralRe: Set icon in CDialog Pin
gUrM33T13-Apr-04 2:34
gUrM33T13-Apr-04 2:34 
GeneralRe: Set icon in CDialog Pin
anderslundsgard13-Apr-04 2:51
anderslundsgard13-Apr-04 2:51 
GeneralLogic Problem with array value assigning Pin
JHAKAS13-Apr-04 1:41
JHAKAS13-Apr-04 1:41 
GeneralRe: Logic Problem with array value assigning Pin
JHAKAS13-Apr-04 19:46
JHAKAS13-Apr-04 19:46 
QuestionTheme with MFC – Possible? Pin
anderslundsgard13-Apr-04 1:12
anderslundsgard13-Apr-04 1:12 
GeneralForm Width Pin
uus9913-Apr-04 1:12
uus9913-Apr-04 1:12 
Hi, how to set form/control width and height in VC++ IDE or in code? I mean, if i want it
to be exactly 100x200pixels, how do i do that in the IDE or by code? Is there anything similar to Visual Basic?


I have a simple program that adds two numbers in array using MMX (inline assembly), the program works fine, the code as shown below,

The result on screen is :
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
which is correct,

however, if i change the line

char incamt[]={u,u,u,u,u,u,u,u};

to

char *incamt;
incamt=new char[8];
for(int j=0;j<8;j++) incamt[j]=u;

the program compiles but the result is wrong! Why is that?
Output:
9 82 117 68 17 18 19 20 17 90 125 76 25 26 27 28 25 98 -123 84 33 34 35 36



#include "stdafx.h"
#include <iostream.h>

void main()
{
const u = 5;

//an array of increment amounts to aid SIMD-style operation
char incamt[]={u, u, u, u, u, u, u, u};

//instr is an array of 24 bytes
char instr[]={65,66,67,68,69,70,71,72,73,74,75,
76,77,78,79,80,81,82,83,84,85,86,87,88};

//the following is an embedded assembly code which
//uses MMX instructions to add in parallel the
//amount u to all the bytes of the array instr
__asm
{
movq mm1,incamt //mm1 has value u in all its 8 bytes
mov cx, 3 //initialize loop count
mov esi, 0 //initialize index register
L: movq mm0, instr[esi] //mm0=next 8 bytes from instr
paddb mm0,mm1 //parallel add 8 bytes of mm0 & mm1
movq instr[esi],mm0 //move result to instr
add esi, 8 //update index register
loop L //loop back
emms //empty MMX state
} //end of assembly code

//C++ code to output the results for verification
for (int i=0;i<24;i++) cout<<int(instr[i])<<" ";
="" cout<<endl;

="" just="" to="" pause="" the="" screen
="" cin="">>i;

} //end of main
GeneralRe: Form Width Pin
gUrM33T13-Apr-04 2:02
gUrM33T13-Apr-04 2:02 
GeneralRe: Form Width Pin
uus9914-Apr-04 2:13
uus9914-Apr-04 2:13 
GeneralURGENT:Redrawing Pin
stelitsisan13-Apr-04 1:00
stelitsisan13-Apr-04 1:00 
GeneralRe: URGENT:Redrawing Pin
wb13-Apr-04 2:05
wb13-Apr-04 2:05 
GeneralWMI errors in VC7 Pin
roadragedave13-Apr-04 0:02
roadragedave13-Apr-04 0:02 
GeneralRe: WMI errors in VC7 Pin
Anthony_Yio13-Apr-04 0:22
Anthony_Yio13-Apr-04 0:22 
GeneralRe: WMI errors in VC7 Pin
roadragedave13-Apr-04 1:34
roadragedave13-Apr-04 1:34 
GeneralRe: WMI errors in VC7 Pin
Mike Dimmick13-Apr-04 3:29
Mike Dimmick13-Apr-04 3:29 
GeneralRe: WMI errors in VC7 Pin
roadragedave13-Apr-04 4:04
roadragedave13-Apr-04 4:04 
GeneralRe: WMI errors in VC7 Pin
Mike Dimmick13-Apr-04 9:09
Mike Dimmick13-Apr-04 9:09 
GeneralRe: WMI errors in VC7 Pin
roadragedave14-Apr-04 1:31
roadragedave14-Apr-04 1:31 
Questionhow shall i add a toolbar to IE using MFC but using WTL/WTL/others Pin
NewtonOfComputers12-Apr-04 23:51
NewtonOfComputers12-Apr-04 23:51 
AnswerRe: how shall i add a toolbar to IE using MFC but using WTL/WTL/others Pin
alto13-Apr-04 0:07
alto13-Apr-04 0:07 
GeneralRe: how shall i add a toolbar to IE using MFC but using WTL/WTL/others Pin
NewtonOfComputers13-Apr-04 0:13
NewtonOfComputers13-Apr-04 0:13 
GeneralXP AutoPlay Error Pin
alto12-Apr-04 23:49
alto12-Apr-04 23:49 
GeneralRe: XP AutoPlay Error Pin
Sathie26-Sep-05 23:31
Sathie26-Sep-05 23:31 
GeneralOnly enable sizing vertical in CDialog Pin
anderslundsgard12-Apr-04 23:28
anderslundsgard12-Apr-04 23: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.