Sonic and Sega Retro Message Board: kcowolf - Viewing Profile - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help

Group:
Oldbie: Oldbie
Active Posts:
20 (0.01 per day)
Most Active In:
Sonic 2 HD (Archive) (13 posts)
Joined:
19-June 08
Profile Views:
1158
Last Active:
User is offline Yesterday, 06:47 PM
Currently:
Offline

My Information

Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Not Telling Not Telling

Contact Information

E-mail:
Private

Previous Fields

National Flag:
us

Latest Visitors

Posts I've Made

  1. In Topic: PROSONIC IS NOW OPEN SOURCE

    16 August 2010 - 12:22 AM

    Late support. Thanks for open sourcing this; I'm looking forward to the release.
  2. In Topic: Hill Top Zone

    30 July 2010 - 06:28 PM

    To me both of the blue posts look flat instead of cylindrical, especially compared to the rock in the background.
  3. In Topic: Some C/C++ questions

    25 November 2009 - 09:47 PM

    That's true. Thanks for clarifying that. Pointers are *usually* used to allocate memory on the heap, but that doesn't have to be the case.

    The most helpful way I learned to think about it is: "pointer == memory address". You have to keep in mind what happens to that memory when your function and your program end.
  4. In Topic: Some C/C++ questions

    25 November 2009 - 08:40 PM

    In the first one, ip points to memory allocated from the heap. You need to free() that memory before your program finishes or it will be leaked. However, you can use that memory from anywhere in your program as long as you maintain a pointer to it.

    The third one is allocated on the stack. As soon as you are out of your current scope (which usually means the end of the current function), the current "plate" is popped and that memory is returned to the system to be used later. Even if you managed to maintain a pointer to the exact memory address where ip is being allocated, it would not be safe to use it since the compiler has assumed you are no longer going to use it and will allow it to be used elsewhere.

    The second one is bad because the value of ip is unknown garbage, and then you dereference it. In other words, you've just written "3" to a random location in memory.

    The pros/cons between stack and heap allocation really depend on what you need to do. For one thing, depending on what kind of system you are working with (for example, an embedded system such as a handheld GPS), you need to be careful about allocating a large chunk of stack memory since you may overflow the stack, but if you only need your variable for the length of a short function, it'd be cumbersome to malloc/free it.

    Let me know if that gives you the information you want, or if there's anything I can clarify.
  5. In Topic: Concept Art & Mockups - Aquatic Ruin Mockups Needed!!

    11 September 2009 - 06:06 PM

    I think the outer ring looks more orange than dark-red.

Friends

kcowolf hasn't added any friends yet.