Search:

Type: Posts; User: Sander

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Actually, your code is "almost C++". I see you...

    Actually, your code is "almost C++". I see you store function pointers in C structs. You are already coding in an object-oriented fashion, even if you don't realize it yet.

    I think you have...
  2. Replies
    14
    Views
    30,020

    examp is a pointer, which (on a 32-bit system) is...

    examp is a pointer, which (on a 32-bit system) is 4 bytes in size. *examp is what its points to, which in this case is the size of your structure.



    You can. The drawback to this technique is...
  3. Replies
    7
    Views
    1,218

    Because C has made the "choice" of mapping...

    Because C has made the "choice" of mapping closely to the computer hardware. In the lowest level of your computer, the CPU performs "wraparound" (as mentioned above) when values don't fit in its...
  4. Replies
    6
    Views
    2,924

    The *scanf() functions return the number of items...

    The *scanf() functions return the number of items read. You shouldn't compare the return value with EOF.

    --
    Computer Programming: An Introduction for the Scientifically Inclined
  5. Replies
    13
    Views
    4,923

    I find this hard to believe. Either you were...

    I find this hard to believe. Either you were comparing different compilers, or something was botched with the comparison.

    --
    Computer Programming: An Introduction for the Scientifically Inclined
  6. Replies
    8
    Views
    19,037

    That depends on what your definition of "bitmap"...

    That depends on what your definition of "bitmap" is. If you mean "the contents of a BMP file" then you are right. But you could also mean "a rectangular array of pixel values" (as opposed to a...
  7. Replies
    36
    Views
    3,393

    Yes, like Daved said. I would assume that your...

    Yes, like Daved said. I would assume that your image class also has some method to get at the pixel data (which you had elided for briefness). A reasonable rule of thumb is that if a function can...
  8. Replies
    8
    Views
    19,037

    That's what all but the most trivial bitmap file...

    That's what all but the most trivial bitmap file formats have. It depends on the exact file format (i.e., is it a BMP file? GIF, JPEG, TIFF, PNG?) what the precise layout of this file header is. ...
  9. Replies
    13
    Views
    1,602

    You can indeed. See Syntactic Aspartame:...

    You can indeed. See Syntactic Aspartame: Recreational Operator Overloading which was published in the Feb 2006 issue of C/C++ User's Journal (the last issue before it's demise).

    --
    Computer...
  10. Replies
    36
    Views
    3,393

    Why are you making DownsampleNTimes a member...

    Why are you making DownsampleNTimes a member function?

    --
    Computer Programming: An Introduction for the Scientifically Inclined
  11. Replies
    8
    Views
    19,037

    It depends in what format the bitmap file is. ...

    It depends in what format the bitmap file is. Many image formats can be read/written with freely available libraries (libjpeg, libpng, libtiff); other formats are relatively simple and can be...
  12. Replies
    3
    Views
    951

    Maybe this (http://www.softintegration.com/)...

    Maybe this would be of interest to you, too. Otherwise, you could indeed just use the installed compiler, perhaps using some self-written glue so it produces a linkable binary, which you can load...
  13. Thread: .net

    by Sander
    Replies
    4
    Views
    1,003

    Actually MS did a pretty good job with C++/CLR. ...

    Actually MS did a pretty good job with C++/CLR. Much better than "Managed C++" where I was constantly having to be paranoid about which pointer was a "real" one and which one was "managed".

    Also:...
  14. Replies
    5
    Views
    2,642

    Not really. In fact, your compiler may already...

    Not really. In fact, your compiler may already be warning you about using an un-initialized variable.

    What you do is define a pointer-to-C-string, then dereference it before giving it a value.
    ...
  15. Replies
    2
    Views
    1,623

    That's actually not so unbelievable. Since the...

    That's actually not so unbelievable. Since the fprintf(...) family of functions is not type safe, it has to rely on your format specifiers to know how to interpret what's on the stack. If you...
  16. Replies
    12
    Views
    2,867

    It should be apparent from the name of the...

    It should be apparent from the name of the function, too. If a function is called "thatWorked()" then I would expect it to return non-zero on success, because that would be easier to read. If you...
  17. Exactly. You define your structs as holding a...

    Exactly. You define your structs as holding a pointer, but that pointer doesn't point to any allocated memory. Yet you poke data into it in your program. The fact that it doesn't crash when...
  18. Thread: Matrix Rotation

    by Sander
    Replies
    5
    Views
    1,805

    Look up "homogeneous coordinates" for an elegant...

    Look up "homogeneous coordinates" for an elegant way to include translation in your matrix multiplications.

    --
    Computer Programming: An Introduction for the Scientifically Inclined
  19. Thread: very simple

    by Sander
    Replies
    6
    Views
    1,310

    That is interesting. I would expect that the...

    That is interesting. I would expect that the compiler can see that m is being used while not initialized.

    I just verified: gcc 3.4.3 indeed doesn't complain, Visual Studio 2005 gives a warning:...
  20. In the thread title, he says he can't use pow()...

    In the thread title, he says he can't use pow() and can't link to the math library. Probably because it's a homework assignment and he is supposed to implement pow() himself.

    Note, BSmith4740,...
  21. Replies
    2
    Views
    4,098

    Yes, that's fine. Elysia is right; what's...

    Yes, that's fine. Elysia is right; what's probably goinig on is that your header contains


    extern "C"


    yet the function is returning a C++ type.

    --
    Computer Programming: An Introduction...
  22. Replies
    28
    Views
    6,497

    I don't think it will be easy to work out the...

    I don't think it will be easy to work out the specifications for your new type. I assume you're trying to make some kind of "wrapper" allowing you to do ordinary math operations, but keep the result...
  23. Replies
    20
    Views
    2,364

    That isn't worth much: adding zeros at the end of...

    That isn't worth much: adding zeros at the end of floating point constants doesn't make them more precise.

    To someone new to computer programming coming from a science or engineering background,...
  24. Replies
    28
    Views
    6,497

    - Will your "custom ranges" always be within the...

    - Will your "custom ranges" always be within the range of an available integer type?
    - Do you want to stick to integers?

    --
    Computer Programming: An Introduction for the Scientifically Inclined
  25. Replies
    7
    Views
    1,071

    Yeah. It was more of a theoretical...

    Yeah. It was more of a theoretical possibility...

    --
    Computer Programming: An Introduction for the Scientifically Inclined
Results 1 to 25 of 53
Page 1 of 3 1 2 3