pointers

C++ Pointer in Function

Possible Duplicate: Whats your preferred pointer declaration style, and why? I know that technically all three ways below are valid, but is there any logical reason to do it one way or the other? I mean, lots of things in c++ are "technically valid" but that doesn't make them any less foolish. int* someFunction(int* input) {...

Memory Freeing Inqury

Additional thanks extend to Daniel Newby for answering my memory usage question (and Martin York for explaining it a bit more). It is definitely the answer I was looking for, but more of my other questions were answered by others. Thanks everyone for clearing up all of my concerns. Very pleased to see things running how I expect them t...

Can't create a list of elements linked by a "Parent".

I'm trying to create a method (using the A* algorithm) that solves a puzzle and returns the steps to that solution. The solution it's easy.. but I can't return the path to that. I used a list of Nodes and then every time a push back a new Node I set the parent pointing to the Node which new came; list<Node> opened; list<Node> closed; ...

Please provide me pointers for css guide lines for mobiles.

Please provide me guidelines for css for mobiles. The specific questions are: What are the recommendations for the width? Should it be fluid? Any recommendations for usage of Ajax in them. Can Jquery be used. Does all the fancy methods supported Any emulators that I must be using? Any framework that would ease the pain? Recommendations...

Which pointer to delete?

I'm trying to multithread something and i have my program set up such that i have a structure/class of variables that will be passed into each thread for processing. In this class, there are variables that hold pointers to arrays some threads have common arrays from which they read data off of, instead of duplicating those arrays, point...

[C++] Adding to a Memory Address Error

This doesn't compile in VSC++ 2008. void* toSendMemory2 = toSendMemory + 4; I am at a loss at why, though I am sure it's very stupid of me. :P ...

Compact pointer notation for opening files

I'm writing a program to open up multiple files given at the command line. I first did it with array notation. That seems to work. Now I am trying to use compact pointer notation for practice and getting used to pointers, but I am not doing it right. Anyone want to tell me what I'm doing wrong? Thanks. #include <cstdlib> #include <f...

Pointer to pointer memory allocation, why is this wrong?

I am just trying to get my head around various pointer concepts and I have the following code: char** a = new char*; // assign first pointer to point to a char pointer char b[10] = "bla bla"; *a = new char; //assign second pointer a block of memory. -> This looks wrong to me!! (**a) = b[2]; So what is wrong with the s...

C++ qsort array of pointers not sorting

Hi, I am trying to sort a buffer full of variable-length records alphabetically in C++. I previously asked how to implement this, and was told to sort an array of pointers to the records. I set up an array of pointers, but realized that each pointer points to the beginning of a record, but there is no way of it knowing when the record s...

Long Pointer to Constant Wide String, what's the function of the Long here?

When you have a LPCWSTR, why is it a Long Pointer? There's no Long in it's definition, as far as I know. Can anybody explain? ...

Pointer arithmetic and arrays: what's really legal?

Consider the following statements: int *pFarr, *pVarr; int farr[3] = {11,22,33}; int varr[3] = {7,8,9}; pFarr = &(farr[0]); pVarr = varr; At this stage, both pointers are pointing at the start of each respective array address. For *pFarr, we are presently looking at 11 and for *pVarr, 7. Equally, if I request the contents...

Pointer argument to boost python

What's the best way to make a function that has pointer as argument work with boost python? I see there are many possibilities for return values in the docs, but I don't know how to do it with arguments. void Tesuto::testp(std::string* s) { if (!s) cout << " NULL s" << endl; else cout << s << endl; } >>> t.testp...

How to get a pointer value in Haskell?

I wish to manipulate data on a very low level. Therefore I've a function that receives a virtual memory address as an integer and "does stuff" with this memory address. I interfaced this function from C, so it has the type (CUInt -> a). The memory i want to link is a Word8 in a File. Sadly i have no idea how to access the pointer value t...

How to remove smart pointers from a cache when there are no more references?

Hi, I've been trying to use smart pointers to upgrade an existing app, and I'm trying to overcome a puzzle. In my app I have a cache of objects, for example lets call them books. Now this cache of books are requested by ID and if they're in the cache they are returned, if not the object is requested from an external system (slow operati...

Pointer issue in C - what am I doing wrong here?

For a bit of background, I'm writing a meter reading application in C for a small 16-bit handheld computer that runs a proprietary version of DOS. I have a screen that displays meter information and prompts the user to type in a reading. When the user presses the enter key on the unit, the following code will execute: /* ... * beginn...

Dereferencing pointers in Go

...

pointer to a specific fixed address

How do you assign a specific memory address to a pointer ? The Special Function Registers in micro such AVR m128 has fixed addresses, the AVR gcc defines the SFR in the io.h header file but I want to handle it myself, thanks for the help in advance. Cheers! ...

Pointer incrementing query

I have been looking at this piece of code, and it is not doing what I expect. I have 3 globals. int x, y, *pointer, z; Inside of main I declare them. x = 10; y = 25; pointer = &x; now at this point &x is 0x004A144 &y is 0x004A138 pointer is pointing to 0x004A144 Now when I increment: y = *++pointer; it points to 0x004...

[C] - Invalid lvalue in assignment error when trying to make a pointer NULL

I have a pointer of a structure type that I made. On program start it begins as NULL and I then malloc/realloc as I need to add/remove these structures and I was just gonna use my pointer to point at the first structure and move through it like an array. When I malloc/realloc I always make the size of the "array"/area in memory one larg...

Is there a boost::weak_intrusive_pointer?

Hi, For legacy reasons I need to use intrusive pointers, as I need the ability to convert raw pointers to smart pointers. However I noticed there is no weak intrusive pointer for boost. I did find a talk about it on the boost thread list, however nothing concrete. Does anyone know of a thread safe implementation of weak intrusive poin...