It seems that in C++ and D, languages which are statically compiled and in which template metaprogramming is a popular technique, there is a decent amount of concern about template instantiation bloat. It seems to me like mostly a theoretical concern, except on very resource-constrained embedded systems. Outside of the embedded space,...
Is there openly available headers which can be used to compile linux socket application (using socket/udp/ip headers). they should define structures like sa_family_t,in_port_t
Mandatory is to use Msdev and not cygwin/gcc or mingw compiler.
...
Hi!
let's say i need to store 8 bools in a struct, but i want to use for them only 1 byte together, then i could do something like this:
struct myStruct {
bool b1:1;
bool b2:1;
bool b3:1;
bool b4:1;
bool b5:1;
bool b6:1;
bool b7:1;
bool b8:1;
};
and with this i could do things like
myStruct asdf;
asd...
I have the following code snippet. I am compiling using the sun studio 12 compiler and have tried boost 1.33 and 1.39
#include <boost/algorithm/string.hpp>
#include <string>
#include <vector>
using namespace boost;
using namespace std;
int main(int argc, char* argv[])
{
string exbyte = "0x2430";
string exbytes = "0x2430,2430...
So, I have a value of type __be16 (2 bytes). In hex, the value is represented as 0x0800 or 2048 in decimal. (16^2 * 8)
So, when I printf this; I do this:
printf("%04X", value); //__be16 value;
//Print a hex value of at least 4 characters, no padding.
output:
0008
printf("%i", value); //Print an integer.
ou...
I'm trying to represent a simple set of 3 probabilities in C++. For example:
a = 0.1
b = 0.2
c = 0.7
(As far as I know probabilities must add up to 1)
My problem is that when I try to represent 0.7 in C++ as a float I end up with 0.69999999, which won't help when I am doing my calculations later. The same for 0.8, 0.80000001.
Is...
Hi All,
I am a newbie here. So please bear with me if this is a duplicate/very trivial Qn. I am not from a Computer Science background. But currently working in software testing. I would like move to software development. I know there is whole interesting areas outside there. But I am facing difficulty in choosing where to start? I have...
I need to test code ported from 32bit to 64bit where pointers are cast around as integer handles, and I have to make sure that the correct sized types are used on 64 bit platforms.
Are there any flags for various compilers, or even flags at runtime which will ensure that malloc returns pointer values greater than the 32bit limit?
Platf...
http://code.google.com/r/hectorchu-go-windows/source/list
If you could compile it successfully, I like to know the procedures of how to.
...
I'm getting the following error from g++ while trying to add iterator support for my linked list class.
LinkedList.hpp: In member function ‘Type& exscape::LinkedList::iterator::operator*() [with Type = int]’:
tests.cpp:51: instantiated from here
LinkedList.hpp:412: error: invalid initialization of non-const reference of type ‘int&’ fr...
So I have the following program:
int main(){
char* one = "computer";
char two[] = "another";
two[1]='b';
one[1]='b';
return 0;
}
It segfaults on the line "one[1]='b'" which makes sense because the memory that the pointer "one" points to must be in read only memory. However, the question is why doesn't the line "two[1]='b'" s...
Obviously this is trivial to do with win32 api - CreateDirectory(). But I'm trying to host an IShellView, and would like to do this the most shell-oriented way. I would have thought that there would be a createobject or createfolder or some such from an IShellFolder. But neither IShellView nor IShellFolder nor even IFolderView seem to...
I have the following c# code
static void Main(string[] args)
{
List<Results> votes = new List<Results>();
}
public struct Results
{
public int Vote1;
public int Vote2;
public int Vote3;
public Candidate precinctCandidate;
};
public class Candidate
{
public Candidate()
...
I am working on the Sphere Online Judge problems (OK I am only on my 2nd lol) and using VC++ 2008 express and have just noticed the "code definition window". What exactly does this thing do? Is it any use to a beginner like me?
...
The standard way of intersecting two sets in C++ is to do the following:
std::set<int> set_1; // With some elements
std::set<int> set_2; // With some other elements
std::set<int> the_intersection; // Destination of intersect
std::set_intersection(set_1.begin(), set_1.end(), set_2.begin(), set_2.end(), std::inserter(the_intersection, ...
I've attempted to write a brief utility functor that takes two std::pair items and tests for their equality, but disregarding the ordering of the elements. Additionally (and this is where I run into trouble) I've written a function to take a container of those std::pair items and test for membership of a given pair argument in a the cont...
Why is the command line arguments count variable (traditionally "argc") an 'int' instead of an 'unsigned int'? Is there a technical reason for this?
I've always just ignored it when trying rid of all my signed unsigned comparison warnings, but never understood why it is the way that it is.
...
I am trying to do something like this:
template <typename T,bool Strong=true>
class Pointer {...};
template <typename T>
typedef Pointer<T,false> WeakPointer;
But this is a compile error ("a typedef template is illegal" VC).
I am trying to avoid doing this using inheritance, beacuse that's more unnecessary work (rewriting constructo...
I'm looking for a good way to find the process ID of a particular Windows Service.
In particular, I need to find the pid of the default "WebClient" service that ships with Windows. It's hosted as a "local service" within a svchost.exe process. I see that when I use netstat to see what processes are using what ports it lists [WebClient] ...
I have developed an array based implementation of a hashTable with several stock names, symbols, prices, and the like. I need to remove a stock from my array. I am told that using the delete operator is bad object oriented design. What is the good object oriented design for deletion?
bool hash::remove(char const * const symbol, stock &s...