Today I was trying to execute my C++ simulation model. Everything looked ok but the Simulator was not workin...
I had defined a class in header file :
class flash_storage_t {
public:
//! ------ Variable delaration ------
//! Some variables defined
//! ------ FUNCTION DECLARATIONS --------
//! Some functions defined
~flash_storage_t(); //! Destructor
uint32_t write(uint32_t addr, uint32_t len, uint8_t data[]);
uint32_t read(uint32_t relative_address, uint32_t len, uint8_t data[]);
void reset();
//! Again some variables defined
private:
//! Variables defined
};
After two days of debugging and putting on code step by step I found out that it happened because I declared the variables after the functions in the above class which is very strange.
The compiler I am using is VC++ 6.0.
One reason might be while object creation the compiler is not able to associate proper space to it. However these optimizations should be taken care by the VC compiler.
So when I declared the class as mentioned below(with the variables defined in "//! Again some variables defined" my code started working.
class flash_storage_t {
public:
//! ------ Variable delaration ------
//! Some variables defined
//! Again some variables defined
//! ------ FUNCTION DECLARATIONS --------
//! Some functions defined
~flash_storage_t(); //! Destructor
uint32_t write(uint32_t addr, uint32_t len, uint8_t data[]);
uint32_t read(uint32_t relative_address, uint32_t len, uint8_t data[]);
void reset();
private:
//! Variables defined
};
Strange but true
Tuesday, March 3, 2009
Monday, March 2, 2009
Srilankan Cricket Team Attacked
Just now heard news about Sri Lankan team attacked in Pakistan. Its time to wake up and grab those coward asses and bomb them.
Learning : Never travel to Pakistan unless u wanna DIE!!!
Learning : Never travel to Pakistan unless u wanna DIE!!!
Subscribe to:
Posts (Atom)





