c++

const and nonconst STL Iterators

What is the difference between a ::const_iterator and an ::iterator and where would you use one over the other? ...

Can I use boost on uclibc linux?

Does anyone have any experience with running C++ applications that use the boost libraries on uclibc-based systems? Is it even possible? Which C++ standard library would you use? Is uclibc++ usable with boost? ...

Lasting influence of C++

What is the lasting influence of C++ (not counting syntax) on the design of newer languages? Edit: This question was originally titled "Is C++ dead? Has it stopped influencing the design of newer languages?" but got closed. However, some of the answers respond to the original title. ...

Where can I find pascal-style railroad diagrams to describe C++ syntax?

(As an alternative to EBNF) ...

In C++ why is grouping not forced by the language on public, private and protected members of a class/struct?

Is it only to allow logical grouping? ...

cfront for C++

Is a cfront tool available for the new C++? For any other modern languages? ...

Open a Specified File in Excel from a GUI - Borland C++

I am using Borland Builder C++ 2009. I want to add a button to a form that allows the user to open a file in Excel that I specify. I can't think of how to do this. I know how to link with other code and executables -- is there a Microsoft Excel executable that I could use? How could I specify the file then? Any hints on this, or at least...

Can I make GCC warn on passing too-wide types to functions?

Following is some obviously-defective code for which I think the compiler should emit a diagnostic. But neither gcc nor g++ does, even with all the warnings options I could think of: -pedantic -Wall -Wextra #include <stdio.h> short f(short x) { return x; } int main() { long x = 0x10000007; /* bigger than short */ printf...

What is the widget name of the Kde bar used in program like Kate? (image inside)

What is the object name of the Kde bar that provide buttons to hide/unhide widgets? I can't find on kde official API references. It's used in program like Kate, Kdevelop. Here the screenshot of the bar of Kate bottom: http://emilio.plugs.it/bar.png ...

Visual Studio C++ project management. How do I handle non-code files in a project?

I have a project in a c++ solution. For that project, I have some config files that I would like to manage from within the project and when I build the project, have those config files added to the executable build path in the proper directory structure. Example: test.exe references config/myconfig.txt Is there a way to setup myconfig...

How to handle arbitrarily large integers

I'm working on a programming language, and today I got the point where I could compile the factorial function(recursive), however due to the maximum size of an integer the largest I can get is factorial(12). What are some techniques for handling integers of an arbitrary maximum size. The language currently works by translating code to ...

tr1::mem_fn and tr1::bind: on const-correctness and overloading

What's wrong with the following snippet ? #include <tr1/functional> #include <functional> #include <iostream> using namespace std::tr1::placeholders; struct abc { typedef void result_type; void hello(int) { std::cout << __PRETTY_FUNCTION__ << std::endl; } void hello(int) const { std::cout << __PRETTY_FUNCTION__ <...

Quick file access in a directory with 500,000 files

I have a directory with 500,000 files in it. I would like to access them as quickly as possible. The algorithm requires me to repeatedly open and close them (can't have 500,000 file open simultaneously). How can I do that efficiently. I had originally thought that I could cache the inodes and open the files that way, but *nix doesn't...

How to add one day to a time obtained from time()

I have a time represented as the number of seconds elapsed since midnight, January 1, 1970, UTC (the results of an earlier call to time()). How do I add one day to this time? Adding 24 * 60 * 60 works in most cases, but fails if the daylight saving time comes on or off in between. In other words, I mostly want to add 24 hours, but somet...

Char ^= 0xB3 equivalent in VBScript

I have the following C++ code: Char ^= 0xB3; Char is a single character in a string. Is there an equivalent in VBScript? ...

Deriving an abstract class from concrete class

Let's say we have a concrete class Apple. (Apple objects can be instantiated.) Now, someone comes and derives an abstract class Peach from Apple. It's abstract because it introduces a new pure virtual function. The user of Peach is now forced to derive from it and define this new function. Is this a common pattern? Is this correct to do?...

Should I use static_cast or reinterpret_cast when casting a void* to whatever

Both static_cast and reinterpret_cast seem to work fine for casting void* to another pointer type. Is there a good reason to favor one over the other? ...

C++ Nested classes forward declaration error

I am trying to declare and use a class B inside of a class A and define B outside A. I know for a fact that this is possible because Bjarne Stroustrup uses this in his book "The C++ programming language" (page 293,for example the String and Srep classes). So this is my minimal piece of code that causes problems class A{ struct B; // fo...

What is the significance of saying main() returns int and returning nothing in body?

Duplicate http://stackoverflow.com/questions/22239/why-does-int-main-compile What is the significance of saying main() returns int and returning nothing in body? ...

How do I select top 10 rows in a table without sorting?

I want to select the top 10 records from a table in SQL Server without arranging the table in ascending or descending order. ...