Search Results

Search found 3592 results on 144 pages for 'pointer'.

Page 10/144 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • My mouse pointer disappears on "system surfaces" , like background picture, menus, background for all kind of system menus

    - by Siegfried
    I have an annoying problem with Ubuntu 11.10, my mouse pointer disappears on the Ubuntu surface ( not in programs like firefox, libre office ..) The mouse pointer is there, but its size is only one pixel and in the white background of e.g. "system" it is not seen at all, although with "ctrl" I can see where it should be. I have not found any place where I can change the size or colors of the mouse pointer. Can anybody help me?

    Read the article

  • setcontext and makecontext to call a generic function pointer

    - by Simone Margaritelli
    In another question i had the problem to port the code unsigned long stack[] = { 1, 23, 33, 43 }; /* save all the registers and the stack pointer */ unsigned long esp; asm __volatile__ ( "pusha" ); asm __volatile__ ( "mov %%esp, %0" :"=m" (esp)); for( i = 0; i < sizeof(stack); i++ ){ unsigned long val = stack[i]; asm __volatile__ ( "push %0" :: "m"(val) ); } unsigned long ret = function_pointer(); /* restore registers and stack pointer */ asm __volatile__ ( "mov %0, %%esp" :: "m" (esp) ); asm __volatile__ ( "popa" ); To a 64bit platform and many guys told me i should use the setcontext and makecontext functions set instead due to the calling conversion differences between 32 and 64 bits and portability issues. Well, i really can't find any useful documentation online, or at least not the kind i need to implement this, so, how can i use those functions to push arguments onto the stack, call a generic function pointer, obtain the return value and then restore the registers?

    Read the article

  • [c++] accessing the hidden 'this' pointer

    - by Kyle
    I have a GUI architecture wherein elements fire events like so: guiManager->fireEvent(BUTTON_CLICKED, this); Every single event fired passes 'this' as the caller of the event. There is never a time I dont want to pass 'this', and further, no pointer except for 'this' should ever be passed. This brings me to a problem: How can I assert that fireEvent is never given a pointer other than 'this', and how can I simplify (and homogenize) calls to fireEvent to just: guiManager->fireEvent(BUTTON_CLICKED); At this point, I'm reminded of a fairly common compiler error when you write something like this: class A { public: void foo() {} }; class B { void oops() { const A* a = new A; a->foo(); } }; int main() { return 0; } Compiling this will give you ../src/sandbox.cpp: In member function ‘void B::oops()’: ../src/sandbox.cpp:7: error: passing ‘const A’ as ‘this’ argument of ‘void A::foo()’ discards qualifiers because member functions pass 'this' as a hidden parameter. "Aha!" I say. This (no pun intended) is exactly what I want. If I could somehow access the hidden 'this' pointer, it would solve both issues I mentioned earlier. The problem is, as far as I know you can't (can you?) and if you could, there would be outcries of "but it would break encapsulation!" Except I'm already passing 'this' every time, so what more could it break. So, is there a way to access the hidden 'this', and if not are there any idioms or alternative approaches that are more elegant than passing 'this' every time?

    Read the article

  • Copy a LinkedList that has a Random Pointer in it

    - by Bragaadeesh
    Hi, First of all this is not a homework, this is an interview question that I got from a company I attended today. You have a singly linked list with the Node structure as the following class Node{ int data; Node next; Node random; } You have a typical singly linked list of length n. The random pointer in each node in the linkedlist randomly points to some Node within the linked list. The Question is to create a copy of the linked list efficiently into a different LinkedList. I said that I will first calculate the Random pointer's position in the linked list and store it in an array. Then create a new linked list normally. Then iterate through the linked list by setting the random pointer where they belong by reading the values stored from the array. I know its a very brute force technique and the interviewer asked me to come up with a better solution but I couldnt. Please can someone answer this? I can explain if the question is not clear.

    Read the article

  • NULL pointer comparison fails

    - by Ilya
    Hello, I'm initializing in a class a pointer to be NULL. Afterwards I check if it is NULL in the same class. But it's not always 0x0. Sometimes it's 0x8 or 0xfeffffff or 0x3f800000 or 0x80 or other strange stuff. In most case the pointer is 0x0 but sometimes it gets altered somehow. I'm sure that I'm not changing it anywhere in my code. Is there a way it gets changed by "itself"? Here's my code: MeshObject::MeshObject() { mesh.vertexColors = NULL; } MeshObject::MeshObject(const MeshObject &_copyFromMe) { SimpleLog("vertexColors pointer: %p", _copyFromMe.mesh.vertexColors); if (_copyFromMe.mesh.vertexColors != NULL) { SimpleLog("vertexColors"); this->mesh.vertexColors = new tColor4i[_copyFromMe.mesh.vertexCount]; memcpy(this->mesh.vertexColors, _copyFromMe.mesh.vertexColors, _copyFromMe.mesh.vertexCount * sizeof(tColor4i) ); } } My application crashes, because vertexColors wasn't initialized and is being copied. However it is NULL and shouldn't be copied. Thanks.

    Read the article

  • Event Dispatching, void pointer and alternatives

    - by PeeS
    i have my event dispatching / handling functionality working fine, but there is one issue that i need to resolve. Long story short, here are the details. // The event structure struct tEventMessage { // Type of the event int Type; // (void*) Allows those to be casted into per-Type objects void *pArgument1; void *pArgument2; }; I am sending events from different modules in my engine by using the above structure, which requires a pointer to an argument. All messages are queued, and then dispatched on the next ::Tick(). It works fine, untill i try to send something that doesn't exist in next ::Tick, for example: When a mouse click is being handled, it calculates the click coordinates in world space. This is being sent with a pointer to a vector representing that position, but after my program quits that method, this pointer gets invalid obviously, cause local CVector3 is destructed: CVector2 vScreenSpacePosition = vAt; CVector3 v3DPositionA = CVector3(0,0,0); CVector3 v3DPositionB = CVector3(0,0,0); // Screen space to World space calculation for depth zNear v3DPositionA = CMath::UnProject(vScreenSpacePosition, m_vScreenSize, m_Level.GetCurrentCamera()->getViewMatrix(), m_Level.GetCurrentCamera()->getProjectionMatrix(), -1.0 ); // Screen space to World space calculation for depth zFar v3DPositionB = CMath::UnProject(vScreenSpacePosition, m_vScreenSize, m_Level.GetCurrentCamera()->getViewMatrix(), m_Level.GetCurrentCamera()->getProjectionMatrix(), 1.0); // Send zFar position and ScreenSpace position to the handlers // Obviously both vectors won't be valid after this method quits.. CEventDispatcher::Get()->SendEvent(CIEventHandler::EVENT_SYSTEM_FINGER_DOWN, static_cast<void*>(&v3DPositionB), static_cast<void*>(&vScreenSpacePosition)); What i want to ask is, if there is any chance i could make my tEventMessage more 'template', so i can handle sending objects like in the above situation + use what is already implemented? Can't figure it out at the moment.. What else can be done here to allow me to pass some locally available data ? Please can somebody shed a bit of light on this please?

    Read the article

  • why no implicit conversion from pointer to reference to const pointer.

    - by user316606
    I'll illustrate my question with code: #include <iostream> void PrintInt(const unsigned char*& ptr) { int data = 0; ::memcpy(&data, ptr, sizeof(data)); // advance the pointer reference. ptr += sizeof(data); std::cout << std::hex << data << " " << std::endl; } int main(int, char**) { unsigned char buffer[] = { 0x11, 0x11, 0x11, 0x11, 0x22, 0x22, 0x22, 0x22, }; /* const */ unsigned char* ptr = buffer; PrintInt(ptr); // error C2664: ... PrintInt(ptr); // error C2664: ... return 0; } When I run this code (in VS2008) I get this: error C2664: 'PrintInt' : cannot convert parameter 1 from 'unsigned char *' to 'const unsigned char *&'. If I uncomment the "const" comment it works fine. However shouldn't pointer implicitly convert into const pointer and then reference be taken? Am I wrong in expecting this to work? Thanks!

    Read the article

  • how to return C++ pointer in objective-C++

    - by John Smith
    I have the following objective-C++ header with the simple method to return this pointer. @interface MyObj { MyCPPObj * cpp; } -(MyCPPObj *) getObj; I have created the simple method @implementation MyObj -(MyCPPObj *) getObj { return cpp; } Everything seems to work until I actually try to use the object in another file newObj = [createdMyObj getObj]; It complains: error: cannot convert 'objc_object*' to 'MyCPPObje *' in initialization. It seems that the method is return an objective-c object, but I specifically requested a C++ pointer. How can I fix that?

    Read the article

  • Use of double pointer in linux kernel Hash list implementation

    - by bala1486
    Hi, I am trying to understand Linux Kernel implementation of linked list and hash table. A link to the implementation is here. I understood the linked list implementation. But i am little confused of why double pointers is being used in hlist (**pprev). Link for hlist is here. I understand that hlist is used in implementation of hash table since head of the list requires only one pointer and it saves space. Why cant it be done using single pointer (just *prev like the linked list)? Please help me.

    Read the article

  • in free(): error: junk pointer, too high to make sense Segmentation fault: 11 (core dumped) gprof

    - by Mayank
    I am trying to profile my application. For this I compiled my code with -pg and -lc_p option, it compiled successfully During run time I am getting the following error. in free(): error: junk pointer, too high to make sense Segmentation fault: 11 (core dumped) Doing GDB gives error as. (gdb) b main Breakpoint 1 at 0x5124d4: (gdb) r warning: Unable to get location for thread creation breakpoint: generic error [New LWP 100085] cacheIp in free(): error: junk pointer, too high to make sense Program received signal SIGSEGV, Segmentation fault. [Switching to LWP 100085] 0x00000000006c3a1f in pthread_sigmask () My application is multi threaded and is a combination of C and C++ code. uname -a FreeBSD 6.3-RELEASE FreeBSD 6.3-RELEASE #0: Wed Jan 16 01:43:02 UTC 2008 [email protected]:/usr/obj/usr/src/sys/SMP amd64 Why is the code crashing. Am I missing something.

    Read the article

  • Function Pointer from base class

    - by camelord
    Hi there, i need a Function Pointer from a base class. Here is the code: class CActionObjectBase { ... void AddResultStateErrorMessage( const char* pcMessage , ULONG iResultStateCode); ... } CActionObjectCalibration( ): CActionObjectBase() { ... m_Calibration = new CCalibration(&CActionObjectBase::AddResultStateErrorMessage); } class CCalibration { ... CCalibration(void (CActionObjectBase::* AddErrorMessage)(const char*, ULONG )); ... void (CActionObjectBase::* m_AddErrorMessage)(const char*, ULONG ); } Inside CCalibration in a Function occurs the Error. I try to call the Function Pointer like this: if(m_AddErrorMessage) { ... m_AddErrorMessage("bla bla", RSC_FILE_ERROR); } The Problem is, that I cannot compile. The Error Message says something like: error C2064: Expression is no Function, that takes two Arguments. What is wrong? regards camelord

    Read the article

  • C: Cannot declare pointer inside if statement

    - by echedey lorenzo
    Hi, I have a pointer which points to a function. I would like to: if (mode == 0) { const unsigned char *packet = read_serial_packet(src, &len); } else { const unsigned char *packet = read_network_packet(fd, &len); } But I cannot do it because my compiler complains when I first use the pointer later in the code. error: 'packet' undeclared (first use in this function) This is strange. It worked without the if statement, but now I need my program to be able to get data from different sources. Isn't it possible to do this? I think so. If it isn't, is there any other simple way to get what I am trying? Thanks a lot.

    Read the article

  • Get pointer to member function from within member function in C++

    - by Eli
    Currently in the program I am attempting to write I need to be able to get a pointer to a member function within a member function of the same class. The pointer needs to be passed to a function as a void (*)(). Example: //CallFunc takes a void (*)() argument class testClass { public: void aFunc2; void aFunc1; } void testClass:aFunc2(){ callFunc(this.*aFunc1); // How should this be done? } void testClass:aFunc1(){ int someVariable = 1; } I'm trying to do this in GCC 4.0.1. Also, the member function being called can't be static because it references non-static variables in the class that it is part of.

    Read the article

  • C 64-bit Pointer Alignment

    - by DuneBug
    Are pointers on a 64-bit system still 4 byte aligned (similar to a double on a 32 bit system)? Or are they note 8 byte aligned? For example, on a 64-bit system how big is the following data structure: struct a { void* ptr; char myChar; } Would the pointer by 8 byte aligned, causing 7 bytes of padding for the character (total = 8 + 8 = 16)? Or would the pointer be 4 byte aligned (4 bytes + 4 bytes) causing 3 bytes of padding (total = 4 + 4 + 4 = 12)? Thanks, Ryan

    Read the article

  • declaring a 2D array of pointer objects

    - by Tyler Stennette
    I'm having a tough time figuring out how to instantiate a 2D array of pointer objects. Here is how I'm doing it: Pieces* chessBoard[9][9]; When I want to set it to an actual object pointer, I'm doing the following: chessBoard[1][1] = new Rook(p1Rook); Rook is a class that inherits attributes from the Pieces class and p1Rook is a char variable set to 'R'. This class also implements virtual functions (not pure virtual) from Pieces such as move() or getPiece() that are unique to the particular chess piece. However, when I compile my program, I get the following error: ChessBoard.cpp:69: error: expected type-specifier before ‘Rook’ ChessBoard.cpp:69: error: cannot convert ‘int*’ to ‘Pieces*’ in assignment Can someone please explain what I should change to get rid of this rather annoying persistent error? I would appreciate it.

    Read the article

  • Inline assembler get address of pointer Visual Studio

    - by Joe
    I have a function in VS where I pass a pointer to the function. I then want to store the pointer in a register to further manipulate. How do you do that? I have tried void f(*p) { __asm mov eax, p // try one FAIL __asm mov eax, [p] // try two FAIL __asm mov eax, &p // try three FAIL } Both 1 and 2 are converted to the same code and load the value pointed to. I just want the address. Oddly, option 1 works just fine with integers. void f() { int i = 5; __asm mov eax, i // SUCCESS? }

    Read the article

  • Inline assembler getaddress of pointer Visual Studio

    - by Joe
    I have a function in VS where I pass a pointer to the function. I then want to store the pointer in a register to further manipulate. How do you do that? I have tried void f(*p) { __asm mov eax, p // try one FAIL __asm mov eax, [p] // try two FAIL __asm mov eax, &p // try three FAIL } Both 1 and 2 are converted to the same code and load the value pointed to. I just want the address. Oddly, option 1 works just fine with integers. void f() { int i = 5; __asm mov eax, i // SUCCESS? }

    Read the article

  • How to I reference a pointer from a different class

    - by Justagruvn
    Hey team of awesomeness!, (Iphone Objective-C question) First off, I despise singletons with a passion. Though I should probably be trying to use one, I just dont want to. I want to create a data class (that is instantiated only once by a view controller on loading), and then using a different class, message the crap out of that data instance until it is brimming with so much data, it smiles. So, how do i do that? I made a pointer to the instance of the data class when I instantiated it. I'm now over in a separate view controller, action occurs, and I want to update the initial data object. I think I need to reference that object by way of pointer, but I have no idea how to do that. yes I've set properties and getters and setters, which seem to work, but only in the initial view controller class. Peace Love applesauce.

    Read the article

  • C++ Pointer Issue

    - by Winder
    _stuckVertices is an array of pointers and I would like to update one index of that array without using _stuckVertices[ (row * _cols) + column ] 3 times. The reason it is an array of pointers is because the vast majority of the time the pointer will be NULL. The following code works but I need to dereference a each time I use it: void Cloth::stickPoint(int column, int row) { Anchor **a = &_stuckVertices[ (row * _cols) + column ]; if (!*a) *a = new Anchor(this, column, row); (*a)->stick(); } I originally had it written like this, but the _stuckVertices pointer doesn't get updated: void Cloth::stickPoint(int column, int row) { Anchor *a = _stuckVertices[ (row * _cols) + column ]; if (!a) a = new Anchor(this, column, row); a->stick(); } Is there a way to write Anchor *a = _stuckVertices[ index ] so that a is like an alias into the array that I can update, or is something like the first piece of code how I should do this? Thanks

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >