CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 56

Thread: Pseudopointers

Threaded View

  1. #11
    Join Date
    Feb 2013

    Re: Pseudopointers

    don't say I don't accept anything because I didn't say I don't accept something,
    that is just what you say.

    the code doesn't need to be changed since it's working in a 32-bit system or at least for me,
    since it doesn't involve another datatype than INT, and is not the point of this topic at all.

    so if you say that it won't work in x64 that is offtopic, because you just can make
    some minnor changes and get that to work for you. so why you get offtopic saying
    this won't work on x64?
    what I wanted to point out is the use of typecasting in basic variables so they work
    as pointer variables.

    I made no assumption at all.
    I understand that the 10 variables are not trusted to be stored contiguously,
    but remember, I relied on an "implementation detail", so as you see there was no
    assumption, but a pure fact. The fact is, it works for me indeed so I can show my point,
    which has nothing to do with x32 or x64 systems, data storage, and so ...
    If this code doesn't work for you, still you can get the point of the topic by
    reading the source code. If you want more, you can make it work for you with just
    some changes.

    point: "typecasting in basic variables so they work as pointer variables".

    why you keep telling other kind of things?


    Quote Originally Posted by Paul McKenzie View Post
    Look, I tell you what: Take this and post it on another board by filling in the number to add to &x so that "OK" gets printed, and come back here and give us a link to the discussion:
    #include <iostream>
    int main()
       static int x;
       static int y;
       int *z = &x + 1;  // What is the magic number to add?  
       if ( z ==  &y )
           std::cout << " OK";  // how will we get here?
           std::cout << "Not OK";

    Paul McKenzie
    by saying this, you just shown me you have not the minimal idea of what is going on in my code, since you lack the static variables initialization value, and your pointer variable is not static either. so as you see you have failed big there.

    #include<windows.h>//or just stdlib.h
    #include <iostream>
    int main(){
    	static int x=0;
            static int y=0;
            static int* z = &x + 1;
        if ( z ==  &y )
           std::cout << " OK\n";
           std::cout << "Not OK\n";
    	return 0;
    anyways, I will took that as some kind of attempt of getting this thread to be a bit funnier
    Last edited by eightyfive; March 22nd, 2013 at 03:25 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.