I'm using g++ on fedora linux 13.
I'm just practicing some exercises from my c++ textbook
and can't get this one program to compile. Here is the code:
double *MovieData::calcMed() {
double medianValue;
double *medValPtr = &medianValue;
*medValPtr = (sortArray[numStudents-1] / 2);
return medValPtr;
}
Her...
Basically, on surfaces that are going to exist right until the program terminates, do I need to run SDL_FreeSurface() for each of them, or would SDL_Quit() take care of all this for me?
I ask mainly because the pointers to a number of my surfaces are class members, and therefore I would need to keep track of each class instance (in a g...
Hi Guys,I use mysql's lib to make a small sql program,when i use mysql_stmt_prepare,then mysql_stmt_reset to excute the query,it always return 1,the error msg is CR_SERVER_LOST,is some one have the same question?Help me Plz:D
...
I'm interested in getting threading into the small engine I'm working on in my spare time, but I'm curious over what the best approuch is. I'm curious about the recommended way to sync the physics thread with the rest of the engine, similar to ThisGuy. I'm working with the Bullet Physics SDK, which already use the data copy method he was...
I'm trying to set up some stuff with Lua, but the specifics of Lua aren't important for my question.
What I would like to be able to do is call a function, say OpenLib<T>(L), and have it get the table name for a particular class (as well as it's table) and register it with Lua. It essentially boils down to this:
template <class T>
sta...
This syntax was used as a part of an answer to this question:
template <bool>
struct static_assert;
template <>
struct static_assert<true> {}; // only true is defined
#define STATIC_ASSERT(x) static_assert<(x)>()
I do not understand that syntax. How does it work?
Suppose I do
STATIC_ASSERT(true);
it gets converted to
static_a...
I want to wirte a function with variable arguments in this way:
static void configElement(U32 localFaultId,
char* name,
U32 report,
U32 localId,
U32 detectTime,
U32 ceaseTime,...)
{
U32 i = 0;
U32 tmp...
hi everyone
is any one knows whats the diffrence between unsigned long to UINT64
i think its the same , but im not sure.
the defenition of UINT64 is :
typedef unsigned __int64 UINT64 (By Using StdAfx.h)
thanks.
...
I need some answers to basic questions. I'm lost again. :(
q1 - Is this statement valid:
Whenever we define the function to be pure virtual function,
this means that function has no body.
q2 - And what is the concept of Dynamic Binding? I mean if the Compiler optimizes the code using VTABLEs and VPTRs then how is it Run-Time Polym...
If you define a type like typedef int MY_INT; and go on to overload, say, the adition operator of MY_INT like
MY_INT operator+(MY_INT a, MY_INT b);
will
MY_INT a, b;
a + b;
be different from
int A, B;
A + B;
?
Sorry for any syntax errors. I'm not near a compiler and I want to ask this before I forget about it.
...
Hi All,
I have attached a code which gives weird outputs basing on cout statements. This program essentially computes the Knuth's Permutations.
Input is say: run1
The code runs for first pass fine:
Call trace will be:
r un1
ur n1
nur 1
1nur
n1ur
nu1r
nur1
After this run of code, the call returns correctly to step where
urn...
Is there any point trying to find threading problems at compile time?
I'm talking about data races, deadlocks, corrupted state etc...
...
Possible Duplicate:
What open source C++ static analysis tools are available?
Which open-source static C++ (not just C) code analysis tools are most suitable for porting code to 64-bit platforms?
...
Is it possible for a multimap to contain within it pairs? IE, rather then being defined as multimap<char,int> for instance, it would be defined as multimap<pair, pair>?
How would this multimap then be sorted? Also, how would one access the individual contents of each pair?
...
Hi there,
I cant seem to find any info on, which algorithms in the NTL C++ libraries are used.
I am especially interested in the algorithms used for:
Modular square root (SqrRootMod)
Kernel of matrix over GF(2) (kernel for mat_GF2 objects)
Greatest common divisor (GCD - this is probably euclids algorithm)
Modular inverse (InvMod)
J...
I've heard that some languages are better suited for a top-down approach to solving problems, while others are intended more for use with a bottom-up technique. Is C++ one of these languages? And if so, which style best suits C++ programming?
...
Hi,
I am having problems with the festival C++ API (Windows XP).
After I make both festival and speech_tools succesfully (Cygwin), I have a file, called festival_example.cc, which contains:
#include <stdio.h>
#include <festival.h>
int main(int argc, char **argv)
{
EST_Wave wave;
int heap_size = 210000; // default scheme heap...
Hello dear StackOverflow!
I'm looking for a useful compression library for c++ (on windows)
I need preferably Deflate or Gzip, and i need it to be compatible with .NET's System.IO.Compression.
Also if it will give me a decorator over a stream that would be great so i could do:
std::ostringstream stringStream;
CompressionStream cs(st...
I want to find out whether a file or a directory is hide.
At first I made use of CFile::GetStatus(), however I found this api sometimes will return FALSE.
I don't know why, So I wrote the following code, However I found it is not stable. What is wrong with my code?
BOOL IsHide(const CString& strPath, BOOL& bIsHide)
{
if (strPat...
My application segfaults sometimes and mainly in malloc() and malloc_consolidate() when I look at the backtrace in gdb.
I verified that the machine has enough memory available, it didn't even start swapping.
I checked ulimits for data segement and max memory size and both are set to 'unlimited'.
I also ran the application under valgrind...