|
Looks like your school book was lost. An example here [^] (sorry no C code).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
You're not going to get code - the code depends on the AST representation, or whatever intermediate form you're using. This page[^] might help.
BTW - are you currently studying a compile construction course @ college...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
actually i need a C prog which takes 3 address byte code as an input(manually) and optimize the given input by Peephole technique.
|
|
|
|
|
The classic book on Compiler Contruction is Compilers by Alfred V. Aho, Ravi Sethi and Jeffrey D. Ullman. A more modern (and more advance book) is Advanced Compiler Design Implementation by Steven S. Muchnick. The first book talks about all aspects of developing a compiler. The second book just talks about code generation and optimization. Both books I feel are quite good.
I am also wondering why you are doing this. Is it part of a compiler? Feel free to ask a follow up question.
Bob
|
|
|
|
|
yup...its a part of compiler...gotta develop a college project on it...(peephole optimization)
|
|
|
|
|
Then I would try to read the book: Compilers by Alfred V. Aho, Ravi Sethi and Jeffrey D. Ullman. I
also wondering what kind of optimizations are you trying to do. For example, contstant folding,
strength reduction and copy propagation come to mind.
Bob
|
|
|
|
|
i need all the methods - Redundant-instruction elimination, Flow-of control optimization, Algebraic simplification and Use of machine Idioms to be applied on 3 address byte code. thanks...
|
|
|
|
|
I believe the first book I mentioned tells you what you need. The flow of control optimization is
elminiating jumps that go to other jumps. That seems straight forward to me. If you are looking
for some code to download where all this is implemented, I do not know of any such code.
Bob
|
|
|
|
|
I've got an app that uses a ShellExecute to launch the default web browser via
ShellExecute(NULL, "open", "http://somewebsite.com", NULL, NULL, SW_SHOWNORMAL);
On XP, sometimes it works and other times it doesn't resulting in an Error code 5 being returned from the ShellExecute (error code 5 = SE_ACCESS_DENIED) indicating that the OS refused to launch the default web browser.
From the MSDN documentation for ShellExecute, I noticed the bit about if what you are launching uses COM, you will need to initialize COM in your app before calling ShellExecute. When I add the CoInitialize(NULL) at app startup (and the CoUninitialize at the close), it fixes the problem and the page launches every time.
This is all great...but why does it work? the only thing I can come up with is that Windows uses COM to determine what app should open html files. Except that doesn't make sense as to why it sometimes works...
What am I missing?
Oh, and Vista/win7 works. This behavior is only seen on XP
|
|
|
|
|
kinar wrote: the only thing I can come up with is that Windows uses COM to determine what app should open html files.
Last time I checked, it consulted the registry.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
DavidCrow wrote: Last time I checked, it consulted the registry.
Did you consult the registry to come up with such conclusion?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
No, I used an API.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I have a C program that prints the tuples in a text file. I am looking for a way, such that those tuples be inserted into MS Access database instead of printing into a text file.
How can I do this?
|
|
|
|
|
Use two tables: one containing the tuple name, and the other containing the tuple data. Link them together with a "key" field.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I have 14 tables in MS Access. I need to insert the tuples in those tables. Is there any way to insert by SQL Commands. I used fprintf to print those tuples in text file. Now need to inset in my existing MS Access tables.
|
|
|
|
|
sxkoirala wrote: I have 14 tables in MS Access.
Are you implying that adding two more would not be possible?
sxkoirala wrote: Is there any way to insert by SQL Commands.
Yes. Are you using MFC?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
i have a simple database application,and it has 5 edit boxes.
Whenever the application starts i want the application to populate the editboxes with whichever record is available at the top of the table(i.e the first record in the table.)
I m using ADO.
How do i do this ?
Do i have to use a sql query for this or MoveFirst( ) function ??
As im using a Doc/View i have to insert this in view`s OnInitialUpdate() function.
But how do i do that ?
modified on Thursday, May 14, 2009 1:03 PM
|
|
|
|
|
See the example here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
|
See here and here and here and here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi
I have a lib Linker problem.
I built "nurbs" dll. This gives me a lib and a dll.
When I tried to link the lib and used " /FORCE:MULTIPLE". . I got a lot of warnings which look like:
warning LNK4006: "void __cdecl PLib::resizeKeepBasic2DArray<struct PLib::HPoint_nD<float,2> >(class PLib::Basic2DArray<struct PLib::HPoint_nD<float,2> > &,int,int)" (??$resizeKeepBasic2DArray@U?$HPoint_nD@M$01@PLib@@@PLib@@YAXAAV?$Basic2DArray@U?$HPoint_nD@M$01@PLib@@@0@HH@Z) already defined in drawtool.obj; second definition ignored.
How can get rid of warning and not using "/FORCE:MULTIPLE".
Best regards,
modified on Thursday, May 14, 2009 12:38 PM
|
|
|
|
|
That says to me that PLib::resizeKeepBasic2DArray is contained in a header and not marked as inline , so there are multiple definitions of the code. You need to either a) mark it as inline, or b) ensure it's only contained in one .cpp file.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi
You are great.
I have one more question for you.
How about the static data member? like "static T dumbVar ;" in the following:
template <>
struct HPoint_nD<double,2>
{
typedef double T;
T *data ;
int created; // usefull to change the data pointer
Point_nD<T,2> projectW() { return Point_nD<T,2>(x(),y()) ; }
protected:
static T dumbVar ;
};
|
|
|
|
|
transoft wrote: How about the static data member? like "static T dumbVar ;" in the following:
Needs to be defined in a cpp file somewhere. This code won't link, because Test<int>::y is missing.
template<class T>
class Test
{
public:
static int y;
};
template<>
class Test<int>
{
public:
static int y;
};
int main()
{
Test<int>::y = 120;
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I have four arrays as input, then used it in a function that result an output. Then I sorted the output array. Next step, I want to find the index and the value of the input array that resulted the sorted array. I keep getting the wrong result.
Here my (part of) code (forgive me for my poor codes;
for (i=0; i<size2; i++){
for (l=0;l<point3[i];l++){
for (a=0;a<b[i][l];a++){
gradient [i][l][a]=(S[i][l][a]-Cy[i][l])/(R[i][l][a]-Cx[i][l]);
}
for (a=0;a<b[i][l]-1;a++){
for (d=a+1;d<b[i][l];d++){
if (gradient[i][l][a]>=gradient[i][l][d]){
temp=gradient[i][l][a];
gradient[i][l][a]=gradient[i][l][d];
gradient[i][l][d]=temp;
}
}
}
}
}
for (i=0;i<size2;i++){
for (j=0;j<point3[i];j++){
for (k=0;k<b[i][j];k++){
for (l=0;l<b[i][j];l++){
if (fabs((S[i][j][l]-Cy[i][j])/(R[i][j][l]-Cx[i][j]))==gradient[i][j][k]){
}
}
}
}
}
The result I have is not for entire array, but just R[1][1][3] and S[1][1][3];
What should I do to fix it?
Thanks.
|
|
|
|