c++

return type of the constructor in C++

I know that there is no return type of the constructors in C++ However, the code below compiles right. What is returned by the constructor in the code below? class A{ public: A() {} } A a = A(); //what is returned by A() here, why? Is there any conflict here? ...

Signedness of char and Unicode in C++0x

From the C++0x working draft, the new char types (char16_t and char32_t) for handling Unicode will be unsigned (uint_least16_t and uint_least32_t will be the underlying types). But as far as I can see (not very far perhaps) a type char8_t (based on uint_least8_t) is not defined. Why ? And it's even more confusing when you see that a ...

Are functions defined in headers guaranteed to be inlined?

If I define a non-member function in a header, will it always be inlined by the compiler, or does the compiler choose based on its heuristics? I know that __inline is just a hint, is it the same with functions in headers? ...

How do i begin writing a windows shell extension?

I'm looking at writing a shell extension so when a file is clicked an action can be performed against it. (Like any other context menu :)) What is the minimum i need to insert a new Menu Item in the Context menu and perform an action against one or more files. A comparative example would be that i selected 10 files and Send to Zip. I...

C++ ERROR: Invalid use of incomplete type ...

I have a small to medium size project that I am doing for my software engineering course this semester. I have chosen to do it in C++ (gtkmm). I am doing okay so far but I have run into a problem with circular references or the following error presented below. Login_Dialog.cpp:25: error: invalid use of incomplete type ‘struct MainWindow...

Map file with GCC on OSX

Hi, I am using GCC on Mac OSX. I am trying to get GCC to create a map(or listing) file of all the symbols in the project so it contains the addresses at which they are mapped. I read in the GCC manual that a way of generating such map files is to pass system specific flags to the GCC linker using -Xlinker option. But I cannot find what...

Why does this code not compile correctly?

I just found my code like this does not compile right? Is there any compiler-provided constructor here? class A { private: A(const A& n); }; int main() { A a; } The error is test.cpp:18: error: no matching function for call to ‘A::A()’ test.cpp:11: note: candidates are: A::A(const A&) I am using g++ unde...

problem with dead keys (acute, diaeresis, etc) c++

Hi everyone: I'm currently writing my own virtual keyboard for linux using the X11 lib and i just can't find the way to simulate a KeyPress event of any dead keys. I'd tried , for example, to write "á" using the asigned macro, which is XK_aacute, and nothing happens. later i'd tried to send XK_acute (the acute accent macro) and then XK...

Quick question: Where is the C++ compiler located in Windows?

Hi all, For some MATLAB code that I want to make executable, I need the location to a compiler in Windows. I have Visual Studio installed, so would I be able to reference the compiler that that uses? If so, how can I find it? Thanks. ...

Parse XML in C++

i want to parse following xml tags <gains>5.640244e+03 5.640322e+03 5.640402e+03 5.640480e+03 5.640560e+03 </gains> using c++.. can any one help me?? ...

Can someone explain C++ Virtual Methods?

I'm learning C++ and I'm just getting into Virtual Functions/Methods. From what I've read (in the book and online), Virtual Methods are methods in the a base class that you can override in derived classes. But earlier in the book, when learning about basic inheritance, I was able to override base methods in derived classes without usin...

socket in linux

my Socket.cpp containing // Implementation of the Socket class. #include "Socket.h" #include "string.h" #include <string.h> #include <errno.h> #include <fcntl.h> Socket::Socket() : m_sock ( -1 ) { memset ( &m_addr, 0, sizeof ( m_addr ) ); } Socket::~Socket() { if ( is_valid() ) ::close ( m_sock ); } bool Socke...

C++ code snippet for a new baby greeting card

A friend of mine sent me this code snippet to celebrate his new baby birth: void new_baby_name() { father_surname++; } The snippet is from his point of view, he is the father and the new baby get the surname from him. I answered with this: class father_name {}; class mother_name {}; class new_baby_name: public father_name, public mo...

socket programming in linux

#include "ServerSocket.h" #include "SocketException.h" #include <string> #include<iostream> int main(int argc, int argv[]) { std::cout << "running....\n"; try { // Create the socket ServerSocket server ( 30000 ); while ( true ) { ServerSocket new_sock; server.accept ( new_sock ); ...

48 bits TIFF format

Hi all. I have an image saved in tiff format which is 24 bits per pixel. May I know if there's a program written in C language or java that can convert the 24 bits per pixel to 48 bits per pixel? ...

Searching and Inserting in a map with 3 elements in C++

I need to have a map like this : typedef std::map<int, float , char> Maptype ; What is the syntax to insert and searching elements of pair in this map. ...

extracting numbers and characters from a string, which doesn't follow a specific format? (postfix calculator)

Hey there, I'm having trouble separating numbers and characters from my input string. The purpose of my program is to add,subtract,multiply and divide in postfix so i cant predict the input form as it can be anything from 2 2 3 + * (answer being 10) to 2 2 + 3 * (answer being 12). So i cant use sscanf to extract the numbers and the opera...

Displaying a pop-up notification window

How do you create a window that pops up from system tray notification area vertically upwards and displays a message? for example - In MSN, it displays it when someone gets online/offline. ...

What C++ book talks about recommended ways of organizing big project C++ code?

I would like to know about books that talk about design issues like when to use namespaces and other coding standards to write good quality efficient C++ code. One that talks about Code testing will also be appreciated. Thanks ...

C++ vector of char array

I am trying to write a program that has a vector of char arrays and am have some problems. char test [] = { 'a', 'b', 'c', 'd', 'e' }; vector<char[]> v; v.push_back(test); Sorry this has to be a char array because I need to be able to generate lists of chars as I am trying to get an output something like. a a a b a c a d a e b a b...