I've written a compiler for a general-purpose programming language that produces an optimised parse tree of its input. This intermediate format is then run through a preprocessor to translate it into a target language for subsequent compilation to a native executable.
At present the only target language is C++, but I'd like to offer oth...
#undef GOOGLE_LONGLONG
#undef GOOGLE_ULONGLONG
#undef GOOGLE_LL_FORMAT
#ifdef _MSC_VER
#define GOOGLE_LONGLONG(x) x##I64
#define GOOGLE_ULONGLONG(x) x##UI64
#define GOOGLE_LL_FORMAT "I64" // As in printf("%I64d", ...)
#else
#define GOOGLE_LONGLONG(x) x##LL
#define GOOGLE_ULONGLONG(x) x##ULL
#define GOOGLE_LL_FORMAT "ll" // As in "%lld...
I am trying to convert a date in a particular format using strptime, and i realized that the information about AM/PM is lost. Not sure why.
Here is the code.
struct tm t;
strptime("Wed 4/18/2007 4:28:22 PM", "%a %m/%d/%Y %H:%M:%S %p", &t);
std::cout<<t.tm_hour<<endl;
strptime("Wed 4/18/2007 4:28:22 AM", "%a %m/%d/%Y %H:%M:%S %p", &t);
...
I usually use C type casting in C/C++ code. My question is, does adding the "const" keyword in the casting type mean anything to the result?
For example, I can think up several scenarios:
const my_struct *func1()
{
my_struct *my_ptr = new my_struct;
// modify member variables
return (const my_struct *)my_ptr;
// return my...
Is there anything equivalent to JNDI in C++?
I am not just looking ldap related libraries. I am interested to know the equivalent API's/Libraries available in C++. Common API for look-up, where implementation can handle against DNS, LDAP, Registry, FileSystem, DB.
...
Possible Duplicate:
In C++, How to get MD5 hash of a file?
I am currently using Ubuntu and am wishing to calculate the MD5 of a char*. was wondering if there is a pre-installed library that would just need including, or would I have to download a specially designed one?
...
I have string with number on ints seperated by space delimiter. Can some one help me how to split the string into ints. I tried to use find and then substr. Is there a better way to do it ?
...
Hi,
I have two functions declared as following, using extern "C" aming to avoid name mangling.
#ifdef __cplusplus
extern "C" {
#endif
JNIEXPORT jobject JNICALL Java_com_trident_tv_si_SIManagerImpl_nGetServiceDetails
(JNIEnv *, jobject, jint);
JNIEXPORT jobject JNICALL Java_com_trident_tv_si_SIManagerImpl_nGetServiceCurrentEvent
(...
I'd like to be able to detect how much graphics memory is available. I've written a C++ project that uses DirectShow.
Some ancient gfx cards can't do video properly and fall back to four colour mode. If I try to allocate more than one video window, the program just crashes on these machines without warning.
This is less than elegan...
Imagine a complex window layout with several windows which are expensive to redraw. Now say a scrollevent needs to update several of these windows simultaneously. The way I do this is to update the scroll position and call Refresh on the windows causing them to receive OnPaint events. However, some of the windows never receive their OnPa...
Hi,
I have a cache object that caches a number of different types of objects, as illustrated below:
class Cache
{
public:
ObjectTable<ObjTypeA> m_objACache;
ObjectTable<ObjTypeB> m_objBCache;
ObjectTable<ObjTypeC> m_objCCache;
};
The (horrible) way I'm currently using the cache at the moment is directly accessing the cache...
#undef GOOGLE_DISALLOW_EVIL_CONSTRUCTORS
#define GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TypeName) \
TypeName(const TypeName&); \
void operator=(const TypeName&)
I'm, reading open source code from google.
Why copy constructor and assignment operator are disallowed?
...
My application mostly works. I'm using QNetworkAccessManager to send a screencapture to a remote FTP server.
If during the middle of the transfer, I unplug my laptop from the internet, the transfer stops. Duh. Of course, it must.
But my problem is that it does NOT send an error anywhere that I can find. And when I reconnect the int...
I implemented an iterator, which has Fibonacci numbers as output. In my main() I'd like to find a number which is dividable by 17 (it's 34). Why doesn't work my find_if statement.
Thank you!
#include <boost/operators.hpp>
#include <algorithm>
#include <tr1/functional>
struct FibIter: boost::input_iterator_helper<FibIter,uns...
My .net project needs to use a third party class library written in C++. I have already tried directly adding a reference to this DLL from the project's context menu 'Add a refence...'' but it did not work as I assume this DLL does not implement the COM object model.
What options do I have now? Some suggest to create a .net wrapper aro...
how to wrtie hai boot loader i know c and c++ please help me out
...
I have a set of classes in a logging framework used by project A and B. I am refactoring the framework so it can be used in project B and C. The refactoring mainly consists of giving everything template parameters: project A might run on an embedded device with poor/no STL implemenatation, while B and C just run on a pc, but B is single ...
Hello,
I have a class that employs a reference counting mechanism. The objects of this class are eventually destroyed by calling delete this when the reference count drops to zero. My question is: can I use local on-stack variable after delete this? Here's a more specific example:
class RefCountedClass
{
public:
RefCountedClass(Mut...
I am using UDP in particular boost::asio::ip::udp::socket sockets if that helps?
What is the header file?
What headers/classes do I need to handle network byte ordering with the UDP under boost?
...
Hello,
I have got a file which is let's say 8 bytes length.
For example it looks like that:
22222222
Now, I read first let's say 5 bytes and changing them. For ex. to 11111
Finally, I want to write them ONTO EXCISTING DATA to the file, so I expect the file to look like that:
11111222
But I get only 11111, because file is erased. Ho...