So it turns out there is a std::string->c_str function. Note: I’m pretty sure this char[] will be deleted when the std::string is deleted…
Tag Archives: c++
C++ PostgreSQL example
Just followed this tutorial on how to create a basic C++ app that talks to a PostgreSQL database…
Code Assistance for C++ in NetBeans: define __cplusplus
See here:
- Go to Tools->Options
- Select C/C++ menu
- Select Code Assistance tab
- Select C++ Compiler tab
- In Macro Definitions list view, locate __cplusplus and change its value from 199711L to 201103L
- Click OK button
C++ Virtual Destructors and Base Classes
I’ve been wondering what happens when a derived class defines a virtual destructor. What about its base destructors? Are they called? If so, when? I finally read the right paragraph in The C++ Programming Language (pg 70):
A virtual destructor is essential for an abstract class because an object of a derived class is usually manipulated through a pointer to a base class. Then, the virtual function call mechanism ensures that the proper destructor is called. That destructor then implicitly invokes the destructors of its bases and members.
Still not sure when the bases and members are destructed, presumably after the derived virtual destructor…
C++ nested classes
Am reading The C++ Programming Language, 4ed, by Bjarne Stroustrup and his sixteenth suggestion for Java programmers (pg 21) is:
A C++ nested class does not have access to an object of the enclosing class.
I didn’t know that!
C++ variables and references
Am reading The C++ Programming Language, 4ed, by Bjarne Stroustrup and his sixth suggestion for Java programmers (pg 21) is:
Remember: a variable is never implicitly a reference.
I didn’t know that!
x86 calling conventions
Reading about x86 calling conventions…
POSIX Signals in C: List of Signals
See POSIX Signals in C for a list of signals…
Pretty printing C# files with extension cs-script in ViewVC
The pretty printing for my *.cs-script files (which are C# files) in ViewVC was really ugly and wrong. I needed to configure the MIME type for *.cs-script files. I edited the mimetypes.conf file and added:
text/x-csharp cs-script
C Pointers Fundamentals Explained with Examples
Read C Pointers Fundamentals Explained with Examples today to brush up on my rusty C skills.