I'm considering a certain solution where I would like to initialize a cell of an array that is defined in other module (there will be many modules initializing one table). The array won't be read before running main (so there is not problem with static initialization order).
My approach:
/* secondary module */
extern int i[10]; // th...
I'm attempting to modify a MIPS simulator to display the contents of its registers during run time. My question refers to the way in which I plan to do this. So...
I have a file, file1.cpp and file2.cpp. There is a local public variable in file1.cpp called
typedef long ValueGPR;
ValueGPR reg[33];
that I want to access in file2.cp...
Im looking at namespaces and i dont really see a difference between these and classes.
im teaching myself c++ ive gotten several books online, so i know im not learning the
most effectively. anyways can someone tell me the difference between the two and what would be the best time to use a namepace over a class. also i dont see much ab...
Hi all,
How can i change the datatype used in storing the pixels in a Mat class instance?
For example after reading an image using the line below
Mat I = imread(file,0);
i obtain a grayscale image with pixels of type unsigned char. I want to change this to a double.
What's the best way to do the conversion? I wasn't able to find a f...
I have a suspicion that there might be a race condition in a certain C++ multithreading situation involving virtual method calls in a vtable dynamic dispatching implementation (for which a vtable pointer is stored as a hidden member in the object with virtual methods). I would like to confirm whether or not this is actually an issue, an...
I have the following code
#include <iostream>
#include<string>
#include <sstream>
using namespace std;
struct product{
int weight;
float price;
};
int main(){
string mystr;
product prod;
product *pointer;
pointer=∏
getline(cin,pointer->price);
return 0;
}
but it shows me the mistake
no instan...
I have recently inherited an old c++ project built in visual studio 2003 that consists of a lot of code that looks like this:
for(int i=7;i<40;i++)
title[i-7]=temp_title[i];
for(i=33;i<80;i++)
title[i] = ' ';
However, since I do not have VS2003, I installed 2008 and now I am running into a lot of compilation errors due to i be...
Hi all,
I maintain a set of C++ tools (bedtools) that are used in the genomics/bioinformatics field. Several users have asked that I create APIs to the libraries such that "hooks" are available for Perl and Python, for example (many requests for Python). Therefore, I am interested in using SWIG, as it has support for C++ and in theo...
Hi,
I normally program on Windows, but I got a macbook pro from my school, so I'm trying to make an OpenGL app for OSX. I downloaded and installed XCode, but I have no clue how to get a simple OpenGL app going. I would prefer not to use Objective-C, but I definitely don't want to use GLUT. Can someone point me in the right direction?
...
What is the best way, to develop a multi threaded program, to delete certain characters from multiple text files that are passed in as parameters?
Thus, when someone passes as a.out axvc f1 f2 f3 f4 , the goal is to delete all occurences of the characters a,x,v,c from the file f1, f2, f3 and f4.
...
Hi,
Sorry to be so application specific, but I noticed another well answered post about Maya development.
I've just written a plugin node for Maya. It just kills a bunch of particles according to a turbulence function. The turbulence is driven by a number of attributes that are adjustable in the attribute editor.
In the attribute edito...
I frequently use the STL containers but have never used the STL algorithms that are to be used with the STL containers.
One benefit of using the STL algorithms is that they provide a method for removing loops so that code logic complexity is reduced. There are other benefits that I won't list here.
I have never seen C++ code that ...
Hello,
is there any way to "listen" to when a function of a dll is called?
I would like to know what functions of a dll is called and the parameters etc....
is it possible?
thanks!
...
Can I write simply
for (int i = 0; ...
instead of
int i;
for (i = 0; ...
in C or C++?
(And will variable i be accessible inside the loop only?)
...
I have problems understanding why when I create two or more nodes (as shown below), the function void del_end()will only delete the char name[20] and not the whole node . How do I fix this problem without memory leak?
#include <iostream>
using namespace std;
struct node
{
char name[20];
char profession[20];
int age;
no...
How can I shift a column in 8x8 area? For example, I have this one 64-bit unsigned integer as follows:
#include <boost/cstdint.hpp>
int main()
{
/** In binary:
*
* 10000000
* 10000000
* 10000000
* 10000000
* 00000010
* 00000010
* 00000010
* 00000010
*/
boost::uint64_t...
I've been "playing around with" boost threads today as a learning exercise, and I've got a working example I built quite a few months ago (before I was interrupted and had to drop multi-threading for a while) that's showing unusual behaviour.
When I initially wrote it I was using MingW gcc 3.4.5, and it worked. Now I'm using 4.4.0 and i...
I have a custom logging system which allows me to send information to a log file and the console depending on the verbosity currently selected. Right now, the trouble I am having is with the output to the file, with output to the console working fine.
Here is an example:
ilra_talk << "Local IP: " << systemIP() << " | Hostname: "...
I have a function in my class that creates a thread and gives it arguments to call a function which is part of that class but since thread procs must be static, I can't access any of the class's members. How can this be done without using a bunch of static members in the cpp file to temporarily give the data to be manipulated, this seems...
This question has no practical issues associated with it, it is more a matter of curiosity and wanting to know if I am taking things too literally ;).
So I have been trying to work towards understanding as much of the c++ standard as possible. Today in my delving into the standard I noticed this (ISO/IEC 14882:2003 21.3.4):
const_refe...