c++

UPDATED! Intellisense auto-complete is causing VC++ in Visual Studio 2005 SP1 to crash

UPDATE1: I have reinstalled Visual Studio and I am still having this problem. My guess is there is a problem with my environment. Update2: Diving in. I attached windbg to devenv and set a breakpoint in windbg for msenv!_tailMerge_WINMM_dll and traced through. This is trying to load winmm.dll using the LoadLibrary API. I can see that ...

Is it okay to store test-cases inside the corresponding class? (C++)

I have started to write my tests as static functions in the class I want to test. These functions usually test functionality, they create a lot of objects, measure memory consumption (to detect leaks), etc. Is this good or bad practice? Will it bite me in the long run? ...

Seeking and reading large files in a Linux C++ application

I am running into integer overflow using the standard ftell and fseek options inside of G++, but I guess I was mistaken because it seems that ftell64 and fseek64 are not available. I have been searching and many websites seem to reference using lseek with the off64_t datatype, but I have not found any examples referencing something equal...

C++ - linking to 3rd party DLL - intermittent access violation

I have been provided with a C++ DLL and associated header file in order to integrate it with my application. To begin with, I am simply trying to call the DLL from a simple Win32 console application (I'm using Visual Studio 2008 Express). I've linked the DLL by specifying it as an additional dependency in the project settings. The inte...

C++: const reference parameters

Is there a difference between the following declarations? void somefunc(const Person &p); void somefunc(Person const &p); ...

C/C++ Memory Problem?

Hi there, Programming for my Arduino (in some kind of mix of C/C++), I noticed something weird. Everytime I communicate through the serial port, I keep an eye on the SRAM usage. Normally, it ranges between 300~400 bytes. However, after adding a new routine (see below), I noticed it always jumped from 300~400 bytes of free memory to EXA...

Does calling a destructor explicitly destroy an object completely?

If I call a destructor explicitly ( myObject.~Object() ) does this assure me that the object will be appropriately destroyed (calling all child destructors) ? Ok some code: class Object { virtual ~Object() {} }; class Widget : public Object { virtual ~Widget() {} }; ... Object* aWidget = new Widget(); //allocate and cons...

What is the best way to develop a C++ web application?

What could be the best way of developing a C++ web application? The web app would be run on Apache HTTP server. How can you overcome challenges like sessions, persistence, context switching, multithreading etc with C++? How could one utilize C++ in best possible way to make it work like Servlets? ...

Trie implementation

Is there any speed- and cache-efficient implementations of trie in C/C++? I know what a trie is, but I don't want reinvent the wheel, implementing it myself. ...

Differentiate between a unix directory and file in C++

Given a path, say, /home/xyz/abc/def, I would want to determine if def is a directory or a file. Is there a way of achieving this in my C++ code? ...

How to return List from c# and use it in vc++ through com

Hi How to return List from c# method and Use the List return values in c++ can u give guidance how to do it?? I going like following way my complete scenario: in c# DemoLib.cs usng System;using System.Collections.Generic; public interface IDiscover { void GetList1(); String GetList2(); List<string> GetList3(); }; namespace Dem...

to verify connectivity of remote machine without using ping command

Is there any method in c++/vc++/mfc so that I can verify whether remote machine is on network or not. I don't want to use ping command. I tried to use WSAConnect method but it takes lot of time in searching if remote machine is not on network. In that case application windoe freezes for long time. I need alternate way to verify remote ma...

generate mpl::vector from fusion::vector

How to generate fusion::vector from mpl::vector? How to generate mpl::vector from fusion::vector? BOOST_MPL_ASSERT((is_same< fusion::vector<int, char>, generate_fusion_vector<mpl::vector<int, char> >::type >)); BOOST_MPL_ASSERT((is_same< mpl::vector<int, char>, gen...

good combination of a c++ toolkit/library, cross platform db (not necessarily sql)

Hi what do you suggest as a cross platform "almost all encompassing" abstraction toolkit/library, not necessarily gui oriented? the project should at some point include an extremely minimal web server and a "db" of some sort (basically to have indexes/btrees, maybe relations, so a rdbms is desiderable but avoidable if necessarily, sql ...

how to avoid "already defined error" in C++

I am gettings these type of errors in a MFC VS6 project while linking the application: msvcrt.lib(MSVCRT.dll) : error LNK2005: _atoi already defined in LIBC.lib(atox.obj) I know what it means (a function exists in 2 different libraries); to solve it I should have to exclude one of the 2 libraries (msvcrt.lib or libc.lib). But if I do ...

Why Fragmentation is Done at IP why not for TCP/UDP.

I am looking for the reason Why Fragmentation is Done at IP level but why not for TCP/UDP. Suppose say my frame looks like this |MAC|IP|TCP|Payload|FCS. the whole size if say for eg: 1600. PathMTU happens here, why fragmentation is implemented @ IP level is my question and why not implemented @ TCP/UDP level/code. Thank in advance. ...

C++ - Generic programming - Type selection

The following fragment returns the next highest power of two for an (assumed unsigned) integer of type T. It does this by shifting the bits repeatedly. For all intents and purposes the unsigned type i used in the bit shifting loop is sufficiently large to represent a (nominally) 65536 bit number. Practically therefore it's fine to lea...

How do I use ArrayList in C++?

Hi, I have created a method who's return type is an ArrayList instead of List. And I have created a COM component. How do I access this ArrayList in my main application which is in C++? ex: ArrayList fun1() { ArrayList al = new ArrayList(); al.Add("one"); al.Add("two"); return al; } So how do I handle this retu...

COM automation using tlb file

Hi, Consider me a novice to windows environment and COM programming. I have to automate an application (CANoe) access. CANoe exposes itself as a COM server and provides CANoe.h , CANoe_i.c and CANoe.tlb files. Can anyone specify how to write a C++ client, for accessing the object, functions of the application. Also, please specify ho...

Why aren't exceptions in C++ checked by the compiler?

C++ provides a syntax for checked exceptions, for example: void G() throw(Exception); void f() throw(); However, the Visual C++ compiler doesn't check them; the throw flag is simply ignored. In my opinion, this renders the exception feature unusable. So my question is: is there a way to make the compiler check whether exceptions are c...