Search:

Type: Posts; User: pantherse

Search: Search took 0.01 seconds.

  1. Replies
    7
    Views
    3,292

    I finally got around to getting this to you:...

    I finally got around to getting this to you: Keith's programming blog: C and C++ Array Intricacies It's not my best writing, so I would appreciate comments/questions.
  2. Replies
    7
    Views
    3,292

    Let me restate, that's MY usual way. This is from...

    Let me restate, that's MY usual way. This is from the malloc/calloc manpage:
    That's the reason why I prefer to use calloc() when allocating arrays. I find it clearer to read, and you don't run the...
  3. Replies
    7
    Views
    3,292

    Okay, here's the stuff to fix your code as it...

    Okay, here's the stuff to fix your code as it stands so it'll work. As for funny pointer tricks, I'll post a link at a later time.

    First, change:
    myPtr = (int*) malloc(intValue + 2); to
    myPtr...
  4. Replies
    5
    Views
    14,166

    Actually what you're doing will only work if BOTH...

    Actually what you're doing will only work if BOTH client and server are running on the same machine. If you need to run this on 2 separate machines, you need to use UDP or TCP protocol. I have a...
  5. Replies
    7
    Views
    3,292

    From the way your code looks, you seem to expect...

    From the way your code looks, you seem to expect myPtr to be used as an int array. Which means, they way you allocated the memory for myPtr
    myPtr = (int*) malloc(intValue + 2); is wrong because...
  6. Replies
    5
    Views
    14,166

    So what exactly does not work? Could you be more...

    So what exactly does not work? Could you be more specific as to what you are expecting to happen and what is actually happening?
  7. Replies
    22
    Views
    3,087

    Ok, so now I'm the one who has a question: In the...

    Ok, so now I'm the one who has a question: In the case of the sample code, the variable "a" has been deallocated since func() has already gone out of scope. The OS doesn't have to necessarily...
  8. Replies
    22
    Views
    3,087

    Elysia, you are correct. However, it is still...

    Elysia, you are correct. However, it is still possible for a Virtual Memory location to be in one physical location one second, and be relocated by the OS the next. I can get back to you once I get...
  9. Replies
    16
    Views
    2,610

    This is purely my personal opinion. I would...

    This is purely my personal opinion. I would suggest you stop immediately with this mindset. Boost is a very great tool like STL. However, it is a very large library and may not be ideal for every...
  10. Replies
    8
    Views
    2,145

    It looks to me like the problem is not with whose...

    It looks to me like the problem is not with whose calling what. Because at the machine level it's all the same. Without having some sample of how you're using the structure it's hard to tell. With...
  11. Replies
    22
    Views
    3,087

    I'd be delighted to explain the code. However,...

    I'd be delighted to explain the code. However, this is going to be a long-winded answer because I'm going into under-the-hood stuff.

    &x prints the memory location for variable x, which in this...
  12. Replies
    8
    Views
    2,145

    You mentioned that your code is a combination of...

    You mentioned that your code is a combination of FORTRAN and C. How are these code interacting with each other? Because program termination because of memory allocation issues is generally SIGSEGV...
  13. Replies
    22
    Views
    3,087

    This example might help you see what int & would...

    This example might help you see what int & would be returning.


    int& func(int &a)
    {
    return a;
    }

    int main()
    {
  14. Replies
    2
    Views
    2,057

    Is that for loop inside the definition of...

    Is that for loop inside the definition of compare(), or is it part of another function?
  15. Replies
    11
    Views
    2,254

    Looks like they learned C++ using Visual Studio 7...

    Looks like they learned C++ using Visual Studio 7 or something. If I recall correctly there was a time when M$ compilers didn't implement the string class completely
  16. Replies
    18
    Views
    4,126

    A word of caution from someone whose had to...

    A word of caution from someone whose had to compile across multiple platforms: The code you have right now may not run on any other platforms that the current one you're using to work on your current...
  17. Have you looked into using C++ Maps? Here's a...

    Have you looked into using C++ Maps? Here's a reference link http://www.cppreference.com/cppmap/index.html.

    Use the x as the key and use the result of your computation as the value if you need to....
Results 1 to 17 of 17