Hi: down to business:
I need to know whether, when a class method in C++ is called, the implicit 'this' pointer is the first argument, or the last. i.e: whether it is pushed onto the stack first or last.
In other words, I'm asking whether a class method, being called, is taken by the compiler to be:
int foo::bar(foo *const this, int a...
Given the code in Main:
// main.cpp
wineries->insert(winery("Lopez Island Vinyard", "San Juan Islands", 7, 95));
Two things will happen:
The winery ctor is invoked where I have intialized the winery private members:
//winery.cpp
winery::winery(const char * const name, const char * const location,
const int acres, const...
I maintain an application running on Windows that allows the user to specify that certain reports are always sent to a specific printer.
I am currently storing PRINTER_INFO_2::pPrinterName for each configured report into the registry. When the report is run, I use EnumPrinters() to locate the correct printer and pass the appropriate ...
Ok, I'm new at C++. I got Bjarne's book, and I'm trying to follow the calculator code.
However, the compiler is spitting out an error about this section:
token_value get_token()
{
char ch;
do { // skip whitespace except '\n'
if(!std::cin.get(ch)) return curr_tok = END;
} while (ch!='\n' && isspace(ch));
...
EDIT: Problem solved. This was (yet another) situation where the problem wasn't really where it looked like it was. The clue was the use of @0xfeeefefe as a pointer to an object. This is an address that is returned by a windows API function when freeing memory... indicating that the object that was being operated on had been deleted.
I'...
I'm trying to overload the operator << as a friend to a template class Pair, but I keep getting a compiler warning saying
friend declaration std::ostream& operator<<(ostream& out, Pair<T,U>& v) declares a non template function
for this code:
friend ostream& operator<<(ostream&, Pair<T,U>&);
it gives a second warning as a recommenda...
What is the difference (memory wise) bewteen:
for(int x=0;x<100;x++)
{
int y = 1+x;
}
and
int y = 0;
for(int x=0;x<100;x++)
{
y = 1+x;
}
I've always wondered if they are the same or the first is a waste of memory?...
...
I am using boost::thread_group to create(using
thread_group::create_thread()) and dispatch threads. In order to limit
the max thread numbers, at the end of each thread, I remove the thread
from the thread_group and delete the thread itself(so that I could
decide whether new threads need to be created). However it hangs
somewhere be...
Hello all,
C# has a nice static method
String.Format(string, params string[]);
that returns a new string with the formatting and values that are provided. Is there an equivalent in C++?
The reason is because I'm using log4cxx and want to take advantage of the macros like
LOG4CXX_DEBUG( logger, expr );
that uses short-circuit ev...
I know that most of you might have noticed now. When you try to evaluate an expression using watch on RAD Studio 2007, it does not evaluate.
For example, if I had a vector, I could not do "vecData.size()", if I do "vecData.size", it just gives an address.
Is there any other way to watch the size and view each element of the vector in R...
I'm C# programmer, and don't introduce with Native.
I have a Native DLL, & I'v to use that in my project, but cause some of types are impracticable in Managed code.
I'll to prepare a DLL in Native(C++), and I want when an event occure, then aware my Managed Code; How can I do that?
...
I have a need to calculate the minimum area rectangle (smallest possible rectangle) around the polygon.
The only input i have is the number of points in polygon.
soryy for the incomplete information . Yes i have the co-ordinates of the points also
Thanks
...
Is it possible to stringify a character in a preprocessor macro without it including the (')s
example:
#define S(name, chr) const char * name = #name chr
usage:
S(hello, 'W'); //should expand to 'const char * hello = "helloW"
Thanks a bunch!,
Andrew
...
Can we write abstract keyword in C++ class?
...
Micropather requires users implement their abstract class "Graph" in order to use the library. What's a good way to do this from C++/CLI so I can use Micropather in .NET?
There are only two methods to implement:
virtual float LeastCostEstimate( void* stateStart, void* stateEnd ) = 0;
virtual void AdjacentCost( void* state, std::vector<...
I'm working on a piece of C++ software which runs on all Windows versions between Windows XP and Windows Vista. In my code, I developed a DLL which links against a standard library (the Qt library). Once my software is deployed, it's not unusual that the user doesn't have the exact same Qt build on his system but a slightly different con...
Hi guys,
I want to know if there's a website that provides amazing code star designs for my console application. For example I want a code that can output the pyramid using for loops:
*
***
*****
*********
Or code that can output the half-life logo using for loops.
It doesn't matter where the code was created, as long as I c...
Hi all.
I'm having a linking issue with a basic C++ program. No, I'm not including .cpp files!
This is what's happening.
main.cpp
#include "header.h"
#include <iostream>
int main() {
std::cout << "Hello!";
}
header.h
#ifndef _HEADER_H
#define _HEADER_H
class Something {
public:
printContents();
};
#endif
something.cpp
...
Freeing developers from dealing with memory management has been touted as one of the principal advantages of managed code languages such as C#. Are there any studies/real-world examples of actual productivity gains of developing commercial applications in C# vs. C++?
...
Hi,
Is it possible to access a base class function which has the same signature as that of a derived class function using a derived class object?. here's a sample of what I'm stating below..
class base1 {
public:
void test()
{cout<<"base1"<<endl;};
};
class der1 : public base1 {
public:
void test()
{cout<<"der1"<<endl;...