Thread: a more advanced technique

  1. #31
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    I don't know what the standard says
    Standard says you can convert any pointer to void* and back without loosing data.
    No garantees for over pointer conversions
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  2. #32
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Nothing about the size?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #33
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Elysia View Post
    Nothing about the size?
    The size of a pointer is not defined by the standard. Standard C or C++, on just x86 architectures, can have 16, 32, 64 or 48 bit pointers, for example. 16-bit pointers are used in small real-mode, where the entire application can fit in 64KB. 32-bit pointers are used in "large" real-mode and 32-bit flat model. 64-bit pointers are obviously in X86-64 mode. 48-bit pointers would be if you use segmented mode with 32-bit pointers, and there are compilers that use that mode, although I do admit that you will be looking into the smaller markets of specialized embedded compilers, and not gcc or MS based compilers.

    In other architectures, we also have pointer systems where a pointer has to be aligned to 32 bits, and bytes are fetched via a supplementary value of "byte within word". So a pointer to int or function would hold only the 32-bit aligned pointer, where a char * would have a "byte-within-word" value stored along with the pointer. These aren't common machined, but I do believe that some older IBM machines are using this method.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  4. #34
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I get they may differ in size, but the question is: is all pointers guaranteed to be the same size on the same system?
    Ie sizeof(void*) == sizeof(int*)
    Or can they be different sizes, even on the same system?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #35
    Registered User
    Join Date
    Jul 2003
    Posts
    110
    Quote Originally Posted by vart View Post
    Standard says you can convert any pointer to void* and back without loosing data.
    No garantees for over pointer conversions
    Read that again carefully, I think you might see that it says something like "object pointers" or "pointer to type T."

    You'll get a compiler diagnostic if you try to convert a function pointer to a void*.

    For function pointers, I'm 99.999% sure that you can convert any function pointer to any other function pointer and back without loss. That's not guaranteed to be true for function pointer to void* and back. Sometimes function pointers can be quite a bit larger than void*. Particularly on Harvard-type architectures which, besides the size issue, use entirely different buses for data and code.
    Last edited by whoie; 08-01-2008 at 02:46 AM.

  6. #36
    Registered User
    Join Date
    Jul 2003
    Posts
    110
    Quote Originally Posted by Elysia View Post
    I get they may differ in size, but the question is: is all pointers guaranteed to be the same size on the same system?
    Ie sizeof(void*) == sizeof(int*)
    Or can they be different sizes, even on the same system?
    I know for a fact that they are not guaranteed to be the same size in C, and they aren't always in reality either. I just don't know for sure about C++, but I would be surprised if the same weren't true.

  7. #37
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by whoie View Post
    Read that again carefully, I think you might see that it says something like "object pointers" or "pointer to type T."

    You'll get a compiler diagnostic if you try to convert a function pointer to a void*.

    For function pointers, I'm 99.999% sure that you can convert any function pointer to any other function pointer and back without loss. That's not guaranteed to be true for function pointer to void* and back. Sometimes function pointers can be quite a bit larger than void*. Particularly on Harvard-type architectures which, besides the size issue, use entirely different buses for data and code.
    Also, function pointers to virtual functions aren't guaranteed to be like "normal" function pointers.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  8. #38
    Registered User
    Join Date
    Jan 2007
    Posts
    330
    Quote Originally Posted by Sebastiani View Post
    >> It's not cracking, hacking, copyright violation or copyright violation, as I see.

    I think that overwriting the memory of another process and then 'disappearing without a trace' most certainly falls within that category. Could it have legitimate uses? Of couse. But the point is, it is a form of cracking.
    Why couldnt we talk about cracking here? I woud love to learn about that stuff too.

  9. #39
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Because it's often used in illegal stuff. Although there are legal uses, that's why the moderators decide on a case-by-case basis.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  10. #40
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Just got done reading this thread. Rule #6 does apply due to this:

    Quote Originally Posted by Yarin View Post
    Yes and no... Look, I have an idea on how to cover my footstep covering footsteps; to the point that it becomes innoteworthy dirt.
    Quote Originally Posted by Yarin View Post
    It's not the keep-viruses-off kind of security. Let's just say it's just suppose to prepare the computer for unwanted visitors.
    You're getting a little too nosy here.
    IMO this shows ill intent and a desire to do harm to another computer system. You can claim it is for self defense but that is a old arguement in world history that rarely holds true for very long.

    Yarin is also on thinner ground due to his previous history here at cboard.


    If this thread stays on the current course of pointer sizes then it'll remain open, but if it reverts to the previous topic it will be closed.

  11. #41
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158
    >> IMO this shows ill intent and a desire to do harm to another computer system.
    The program is a Zeroing-Out program, to delete sensitive data.
    How do you come to the conclusion that I'm trying to hurt someone else's system? Sure, this method may be used in bad software, but if that's reason enough to paste a crook sticker on me, then we might as well stop using exes all together, after all, most viruses are exes.

    >> Yarin is also on thinner ground due to his previous history here at cboard.
    How? I've never been involved in any illegal stuff before. Only a personal opinion disagreement catastrophe.

  12. #42
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Let's just say it's just suppose to prepare the computer for unwanted visitors.
    Can mean and be interpreted many different ways. Due to your history I choose to interprete it on the more conservative side.

    How? I've never been involved in any illegal stuff before. Only a personal opinion disagreement catastrophe.
    Do you really want me to go into this in public Queatrix?

  13. #43
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158
    >> Do you really want me to go into this in public Queatrix?
    Queatrix is an old handle, I prefer by my new one. Even so, please PM me anything you have to show that I was ever involved in viruses or anything related.

    EDIT:
    Better yet, go ahead and post it.
    Last edited by Yarin; 08-02-2008 at 06:46 PM.

  14. #44
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Quote Originally Posted by Yarin View Post
    >> IMO this shows ill intent and a desire to do harm to another computer system.
    The program is a Zeroing-Out program, to delete sensitive data.
    How do you come to the conclusion that I'm trying to hurt someone else's system?
    Perhaps is the need to "cover your tracks". Why is that necessary, or is that too nosy again?

  15. #45
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    You can harm another system without using a virus. I didn't actually mention virus, you did.

    Now from your behavior as Queatrix and the fact that you technically in violation of Rule 14 you don't get as much benefit of the doubt as other people.

    And when I see
    You're getting a little too nosy here.
    I immediately get suspicious.

    If you disagree you are more then welcome to ask another mod to look it over and give their opinion. If you notice I haven't closed this thread, just warned against the orginal topic matter.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A more advanced port scanner
    By fssp in forum C Programming
    Replies: 6
    Last Post: 03-23-2009, 01:14 AM
  2. What's advanced c++ contents ?
    By toysoldier in forum C++ Programming
    Replies: 8
    Last Post: 09-27-2004, 08:12 PM
  3. Advanced? Not Advanced? Anyone?
    By Jotun in forum C++ Programming
    Replies: 3
    Last Post: 04-28-2004, 08:02 PM
  4. Advanced but yet general
    By Rhodium in forum C Programming
    Replies: 6
    Last Post: 08-09-2003, 12:46 PM
  5. Advanced Linux Programming
    By drdroid in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 07-24-2003, 02:01 PM