c++

How to limit the impact of implementation-dependent language features in C++?

The following is an excerpt from Bjarne Stroustrup's book, The C++ Programming Language: Section 4.6: Some of the aspects of C++’s fundamental types, such as the size of an int, are implementation- defined (§C.2). I point out these dependencies and often recommend avoiding them or taking steps to minimize their impact. Why should ...

Creating Map from Alternate Key Value Input

Dear all, I have a data that looks like this: >day11:1:356617 ACTTCTGATTCTGACAGACTCAGGAAGAAACCAT >day11:2:283282 CTCAGCCCGTAGCCCGTCGGTTCCGGAGTAAGTT >day11:3:205058 NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN >day11:4:202520 AGTTCGATCGGTAGCGGGAGCGGAGAGCGGACCC >day11:5:107099 AGGCATTCAGGCAGCGAGAGCAGAGCAGCGTAGA >day11:6:106715 CTCTTTGCCCCATCTACTGC...

Can you set the size of the call stack in c++? (vs2008)

Im working from an example peice of code that allocates a relatively large local array. (32768 to be precise) When i try the same i'm getting behaviour that appears to be a stack overflow. Now i was wondering if my example has maybe set the stack to be larger then my application. Is this possible? if so how? Many thanks ...

Can Events be Inter-Process?

I have created an event in one process and to test, sent the event handle via a pipe to a totally separate process (not a child thread) When I fire the event in the first, WaitForSingleObject does not detect the event so I am guessing the answer is no unless I missed some trick in the SECURITY_ATTRIBUTES structure? Or perhaps I need to...

Static vs. member variable

For debugging, I would like to add some counter variables to my class. But it would be nice to do it without changing the header to cause much recompiling. If Ive understood the keyword correctly, the following two snippets would be quite identical. Assuming of course that there is only one instance. class FooA { public: FooA() : c...

template default argument in a template

Hey, I am trying to compile this : template <class T, class U = myDefaultUClass<T> > class myClass{ ... }; Although it seems quite intuitive to me it is not for my compiler, does anyone knows how to do this ? edit : Ok, the problem was not actually coming from this but from a residual try ... Sorry about this, thanks for your ans...

linux kernel module linker warnings: "*** Warning: <function> [<module>] undefined!" - any way to get rid of them?

While compiling Linux kernel modules that depend on each other, linker gives undefined symbol warnings like Building modules, stage 2. MODPOST *** Warning: "function_name1" [module_name] undefined! *** Warning: "function_name2" [module_name] undefined! *** Warning: "function_name3" [module_name] undefined! The unresolved symbols ar...

Resolve circular dependencies in c++

Hi, I often find myself in a situation where I am facing multiple compilation/linker errors in a C++ project due to some bad design decisions (made by someone else :) ) which lead to circular dependencies between C++ classes in different header files. But fortunately(?) this doesn't happen often enough for me to remember the solution to...

Why does the output fail to show the content of a variable after merely adding a cout line?

#include <iostream> using namespace std; class Marks { public: char* name(); }; char* Marks::name() { char temp[30]; cout<<"Enter a name:"<<endl; cin.getline(temp,30); return temp; } int main () { char *name; Marks test1; name=test1.name(); //cout<<"name:"; //uncomment this line to see the problem...

Are there any reasons not to use Visual Studio 6 for C++?

Are there any reasons why I shouldn't use Visual Studio 6 for C++ development? Where can I find some resources why this would or wouldn't be a good idea? Are there any lists of issues I would have with this? ...

_bstr_t to UTF-8 possible?

I have a _bstr_t string which contains Japanese text. I want to convert this string to a UTF-8 string which is defined as a char *. Can I convert the _bstr_t string to char * (UTF-8) string without loosing the Japanese characters? ...

Inheritance issues with template classes

Can anyone figure out a nice way to get the following code to work? (This is, once again, an incredibly simplified way of doing this) template <class f, class g> class Ptr; class RealBase { }; template <class a, class b, class c = Ptr<a,b> > class Base : public RealBase { public: Base(){}; }; template <class d, class e> class D...

Question on using realloc implementation in C++ code

Friends In our C++ , Iam current using realloc method to resize the memory allocated by malloc. realloc() usage is done as below my_Struct *strPtr =(my_struct*)malloc(sizeof(my_Struct)); /* an later */ strPtr = (my_struct*)realloc(strPtr,sizeof(my_Struct)*NBR); now wikipeadia (_http://en.wikipedia.org/wiki/Malloc)says that If in...

SOLVED threading in a dll where the dll must return before child thread finishes

I am working on writing a wrapper dll to interface a communication dll for a yokogawa WT1600 power meter, to a PC based automation package. I got the communication part to work but I need to thread it so that a 50ms scan time of the automation package can be maintained. (The Extended Function Block (EFB) Call will block the scan until it...

Overloading << operator C++ - Pointer to Class

class logger { .... }; logger& operator<<(logger& log, const std::string& str) { cout << "My Log: " << str << endl; return log; } logger log; log << "Lexicon Starting"; Works fine, but i would like to use a pointer to a class instance instead. i.e. logger * log = new log(); log << "Lexicon Starting"; Is this possible? If ...

Embedding a Ruby interpreter in a C++ app

I'm hoping to use Ruby as a scripting language for my game engine. I've found the usual articles describing how to call Ruby classes from C++ code and vice versa (e.g. here) but I can't quite see how to do what I want with that way of working... My engine currently uses a little language I wrote myself with Flex and Bison, and a little ...

Cannot load symbols in GlowCode x64

This question might be too application specific to be out here on SO, but here goes. I am trying to profile a simple native c++ application using GlowCode-x64 6.2 . The problem is that no matter which settings I set in the "Options->Symbol server and search path" the symbols are never loaded. My .pdb files are all in the same folder a...

How to conditionally choose the C# class I invoke via COM in my C++ DLL?

After much help from all my StackOverFlow brethren, I managed to create a C++ DLL that calls my C# classes via COM and passes data back and forth to an external application. There was much celebration in the kingdom after that code started working. Now I have a new problem. I'm expanding the DLL so that it can call different classes (al...

What is the impact of namespaces in c++ linkages compared to linkages in c?

What is the impact of namespaces in c++ linkages compared to linkages in c? Is it possible to make a name that has internal linkage to external linkage just by using namespace.Similarly the other way around. ...

CComboBox automatically selects text after call to MoveWindow

I'm currently experiencing a very strange problem with a CComboBox used within a CFormView. After adding strings to the combobox (created with WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_SORT | CBS_AUTOHSCROLL), I'm selecting an entry via CComboBox::SetCurSel and resize the combobox via MoveWindow in the OnSize(...