Search:

Type: Posts; User: matsp

Page 1 of 20 1 2 3 4

Search: Search took 0.07 seconds.

  1. Replies
    17
    Views
    2,112

    And the reason for this is that no one has dared...

    And the reason for this is that no one has dared do what the Italians, Spanish and French did: Rework the dictionary whilst not too many people could read/write, so that spelling and pronunciation...
  2. Replies
    13
    Views
    1,061

    Use any of the common mechanisms such as while,...

    Use any of the common mechanisms such as while, do - while or for. Even goto would be better than calling main recursively [recursively here means calling it from a call that somehow came from main],...
  3. Replies
    24
    Views
    2,146

    As I thought, someone would give a quick...

    As I thought, someone would give a quick answer...

    In addition, to prevent inheritance, the actual constructor would have to be private, right?

    --
    Mats
  4. Replies
    24
    Views
    2,146

    I think you are doing something wrong in your...

    I think you are doing something wrong in your code if a derived class is generally valid, but can't be used where the base-class can be used. You either haven't made something virtual that should be...
  5. Replies
    9
    Views
    6,606

    If we assume that "uniform" means "it's roughly...

    If we assume that "uniform" means "it's roughly the same likelihood of getting all numbers in the expected range", then I'd agree with Tabstop. rand() is not perfect, but for many things it's good...
  6. Replies
    5
    Views
    1,442

    Why would you? So &my_struct.age, or &st_ptr->age...

    Why would you? So &my_struct.age, or &st_ptr->age will give you the address of the element age - a pointer to an integer, which is what scanf should have. If you do not use the & operator, you get...
  7. Thread: bitset + memcpy

    by matsp
    Replies
    7
    Views
    7,200

    That certainly won't work. For several reasons....

    That certainly won't work. For several reasons.
    1. &key gives you the address of the object itself (unless operator & for the object has been overridden, which I doubt in this case).
    2. The last...
  8. Thread: C++ Exceptions

    by matsp
    Replies
    4
    Views
    1,980

    Could you give us the exact error code. "In page...

    Could you give us the exact error code. "In page error" is not a regular error message. It may have got lost in translation somehow.

    --
    Mats
  9. Replies
    17
    Views
    3,124

    The memory you get back from malloc() is...

    The memory you get back from malloc() is completely undefined, never mind that the memory OUTSIDE this is not to be touched - it may not give you an error to read [or even write] it, but it doesn't...
  10. Thread: malloc function

    by matsp
    Replies
    9
    Views
    1,823

    If your system runs out of memory, bad things MAY...

    If your system runs out of memory, bad things MAY happen. Most OS's keep some memory in reserve so that system critical functions can still allocate memory.

    If your application uses up all the...
  11. Goto is valid if it truly simplifies the code. ...

    Goto is valid if it truly simplifies the code.

    If you have a function which takes a couple of locks and then needs to release them [and there isn't a good way using C++ objects to AUTOMATICALLY...
  12. Thread: pid's

    by matsp
    Replies
    5
    Views
    1,872

    Your code starts three children: A, which then...

    Your code starts three children:
    A, which then returns to start a B process.
    and B started from the main process.

    So you have two "B" processes, one with the main process as parent, and one...
  13. Replies
    4
    Views
    5,342

    Can you describe, in a different way, what you...

    Can you describe, in a different way, what you are trying to do.

    What does "external tcp/ip stack" mean? A "non-kernel" tcp/ip stack?

    Why do you want to do that? What would the end result be?...
  14. Replies
    10
    Views
    3,812

    The answer to your question is "it depends". ...

    The answer to your question is "it depends".

    A global variable is GENERALLY a bad idea. It causes unnecessary connections between function calls that MAY not need to be connected.

    The better...
  15. Thread: sum problem

    by matsp
    Replies
    6
    Views
    959

    The order you do things in C is important. The...

    The order you do things in C is important. The value of c is calculated before the input of a and b, so what value do you think c will have?

    --
    Mats
  16. I'm with you, Brewbuck! If I suggested such a...

    I'm with you, Brewbuck!

    If I suggested such a thing on the ~ 300MHz processors that go into our product, I'd be severely told off by whoever reviews the design document (or code if the design...
  17. Replies
    7
    Views
    4,693

    for(p = head; p; p = p->next) ... for-loop...

    for(p = head; p; p = p->next) ...

    for-loop walking through a linked list.

    --
    Mats
  18. Replies
    25
    Views
    2,892

    nonoob: I agree completely: C is not a good...

    nonoob: I agree completely: C is not a good beginner language, for the reasons you suggest: It is very low level [sure there are some really high-level functions in there].

    The key here is that...
  19. Replies
    18
    Views
    5,006

    Both VAX (32-bit version of PDP-11 really) and...

    Both VAX (32-bit version of PDP-11 really) and 68000 have post-increment and pre-decrement versions of it's instruction set. I'm fairly sure that ARM's instructions also matches the C language fairly...
  20. Replies
    6
    Views
    3,934

    As Laserlight points out, new and malloc behaves...

    As Laserlight points out, new and malloc behaves differently when there isn't enough memory to satisfy the request. However, the other part of the question is sort of "what should I use", which I...
  21. Replies
    6
    Views
    3,934

    You mean aside from the fact that new/delete...

    You mean aside from the fact that new/delete calls the constructor/destructor for the objects it creates, which malloc/free doesn't. Sure, beside that fact, they are pretty much the same. They both...
  22. One of the things that can lead to problems is a...

    One of the things that can lead to problems is a program that does something like this:


    for(i = 0; i < LARGE_NUMBER; i++)
    {
    ....
    ptr = realloc(ptr, i * sizeof(sometype));
    ptr2 =...
  23. Replies
    38
    Views
    3,921

    A proper "idle loop" will be: here: ...

    A proper "idle loop" will be:


    here:
    hlt
    jmp here


    But for efficiency, the idle-loop may look more like this:
  24. Replies
    5
    Views
    904

    What exactly are you having trouble with? --...

    What exactly are you having trouble with?

    --
    Mats
  25. Replies
    7
    Views
    2,853

    What tabstop is trying to say is that the -C...

    What tabstop is trying to say is that the -C option to "make" is "Go to subdirectory of next argument". Since the next thing you give is "SUBDIR=...", make will try to go to a directory called...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4