I'm writing a compiler for a small language, and my Parser class is currently in charge of building an AST for use later. However, recursive expressions are not working correctly because the vector in each AST node that holds child nodes are not working correctly. Currently my AST's header file looks like this:
class AST
{
public:
e...
Hi all!
I have a CognitiveEntity class, defined this way:
class CognitiveEntity : public Object
{
public:
CognitiveEntity (FuzzyCognitiveMap fcm, SystemState s);
~CognitiveEntity ();
template <typename T> void RegisterChange (std::string context, T value);
bool operator!= (const CognitiveEntity& rhs) const;
private:
FuzzyC...
In C++, is it possible to make a multi-statement macro with nested if statements inside of it like the one below? I've been attempting it for a while now and I'm getting a scope issue for the second if statement not being able to see 'symbol'. Maybe I need to understand macros further.
#define MATCH_SYMBOL( symbol, token)
if(someth...
hi!
I would like to pass a pointer by reference to a function, such that i can actually change the address the passed pointer is pointing to and i'd like to assign this argument a default value.
something like this:
in the declaration
void myFunc(SomeType* &var=NULL);
and the definition:
void MyClass::myFunc(SomeType* &var){
i...
I am trying to do something like this:
for ( std::list< Cursor::Enum >::reverse_iterator i = m_CursorStack.rbegin(); i != m_CursorStack.rend(); ++i )
{
if ( *i == pCursor )
{
m_CursorStack.erase( i );
break;
}
}
However erase takes an iterator and not a reverse iterator. is there a way to convert a reverse ...
It's been a while since I touched COM so be nice ;) This is under WindowsCE 5.0 with SQLServerCE 2.0.
After calling this to load SQLServerCE 2.0 : -
IDBInitialize *pIDBInitialize = NULL;
CoCreateInstance(CLSID_SQLSERVERCE_2_0, NULL, CLSCTX_INPROC_SERVER, IID_IDBInitialize, (void**)&pIDBInitialize);
Module load occurs for SSCE20.dll w...
I'm supporting a large system written in C++ and we now have a requirement for our application to talk with a third party system which only provides a JTAPI interface. It would appear that I am stuck writing a JTAPI proxy in Java that talks JTAPI on one side and some more language-neutral API on the other. However, this feels like it sho...
Hi friends, i am new to this linux framebuffer so do anybody guide me to draw the line-graph in framebuffer. And i have the code to draw graph in turbo c but now in linux. So please help me out.
Thank You,
Rahul
...
I'm using Vim for a C++ project that I've started working on and I've been spending a lot of time lately browsing through the existing code to get a hang of it. To make the browsing easier, I've setup ctags and cscope in Vim to jump to definitions and find references.
However, I find that neither of them are intelligent enough to know w...
I have been using python's native bignums for an algorithm and decided to try and speed it up by converting it to C++. When I used long longs, the C++ was about 100x faster than the python, but when I used GMP bindings in C++, it was only 10x faster than the python (for the same cases that fit in long longs).
Is there a better bignum im...
I want to know why exactly static variables in C, C++ and Java are initialized by zero by default? And why this is not true for local variables?
...
Well, I'm not really in serious need of this answer, I am just inquisitive.
Expressions like *ptr++ = a are perfectly valid since we are operating on two objects ptr and *ptr but if i write *ptr++ = *ptr + a is it still valid ?
For example consider the following snippet:
int main(void){
int a[] = {5,7,8,9,2};
int* p =a;
*p+...
I have code that manipulates binary files using fstream with the binary flag set and using the unformatted I/O functions read and write. This works correctly on all systems I've ever used (the bits in the file are exactly as expected), but those are basically all U.S. English. I have been wondering about the potential for these bytes to ...
Hi
I've seen this topic about UMFPack and its usage.
http://stackoverflow.com/questions/1242190/c-memory-efficient-solution-for-axb-linear-algebra-system
But I couldn't implement it in Visual Studio 2008!
I want to use C++ and UMFPACK to solve a triplet mode (Sparse Matrix) and nothing else!
I dont wnat any report or something, I just...
Hi, I was trying hard to make ANTLR 3.2 generate parser/lexer in C++. It was fruitless. Things went well with Java & C though.
I was using this tutorial to get started: http://www.ibm.com/developerworks/aix/library/au-c%5Fplusplus%5Fantlr/index.html
When I checked the *.stg files, I found that:
CPP has only
./tool/src/main/resources/...
hey,
there is something i still don't get.
for every class i declare there is a hidden vptr member pointing to the class virtual table.
let's say i have this declaration :
class BASE
{
virtual_table* vptr; //that's hidden of course , just stating the obvious
virtual void foo();
}
class DERIVED : public BASE
{
virtual_tabl...
Thanks eveyerone for giveing me some idea's to try and I'll try them.
The code it runs now.
**** IT RUNS LIKE THIS
Input room dimensions
Length? ( I enter 12 )
Width? ( I enter 10)
Height? ( I enter 8)
MY Answer = You will need the following amount of paint in gallons: 3
Press any key to continue ….
But I need it to say ( You ...
Hi All,I am just browsing through this very old webpage,
http://www.cs.cornell.edu/Info/Courses/Fall-97/CS432/proj3/index.html
and find this project interesting,since I just started learning C++,I really like to try doing the simplest "Tuple-At-A-Time" join as mentioned on the page using C++.
I know how Tuple-at-a-time works,but had a...
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/mman.h>
int main()
{
int fbfd = 0;
struct fb_var_screeninfo vinfo;
struct fb_fix_screeninfo finfo;
long int screensize = 0;
char fbp = 0;
int x = 0, y = 0;
long int location = 0;
// Open the file for reading and writing
fbfd = open("/dev/fb0",...
I need to convert an integral type which contains an address to the actual pointer type. I could use reinterpret_cast as follows:
MyClass *mc1 = reinterpret_cast<MyClass*>(the_integer);
However, this does not perform any run-time checks to see if the address in question actually holds a MyClass object. I want to know if there is any b...