Search:

Type: Posts; User: laserlight

Page 1 of 20 1 2 3 4

Search: Search took 0.11 seconds.

  1. Replies
    2
    Views
    39

    You used || instead of | I'm a bit puzzled why...

    You used || instead of |

    I'm a bit puzzled why you would use bitwise or though: wouldn't that mean that differing msb and lsb parts can result in the same device id?

    EDIT: oh, I misread the...
  2. Replies
    5
    Views
    162

    The behaviour is undefined because you attempt to...

    The behaviour is undefined because you attempt to modify the same object more than once between consecutive sequence points (or you read it and also modify it separately). So, the reason why you get...
  3. Replies
    2
    Views
    84

    You're reading an entire line, then you're...

    You're reading an entire line, then you're reading more input to ignore it, before you print the next prompt.

    So when the user enters their name, you're still waiting for them to enter something...
  4. Replies
    2
    Views
    69

    I use clang's C++ compiler on macOS Catalina at...

    I use clang's C++ compiler on macOS Catalina at the command line, although out of habit I invoke it as g++. I did not install Xcode, and in fact I use VS Code to edit C++ code.
  5. Replies
    5
    Views
    277

    Firstly, you should be aware that this: double...

    Firstly, you should be aware that this:

    double convert(double abw_to_abv[9], double abw);
    is equivalent to:

    double convert(double abw_to_abv[], double abw);
    which is equivalent to:

    double...
  6. Replies
    12
    Views
    286

    Well, if you want further help, I'd suggest that...

    Well, if you want further help, I'd suggest that you start my answering my questions from my previous post:
  7. Have you seen this issue elsewhere in the...

    Have you seen this issue elsewhere in the meantime?

    I'm afraid that while moderators have been given some magic, the deep magic required to correct the fabric of this universe belongs to the...
  8. Replies
    2
    Views
    123

    In your original code, I would change this: ...

    In your original code, I would change this:

    while(scanf("%d", &num) != EOF)
    to this:

    while(scanf("%d", &num) == 1 && num != -1)
    That is, you keep looping as long as you read and assign 1...
  9. Replies
    12
    Views
    286

    It already is a float. What you want to do is...

    It already is a float. What you want to do is print a textual representation of the float.


    What's the point? ftoa is a non-standard function, whereas you have the family of printf/sprintf...
  10. Replies
    12
    Views
    286

    How does it not work? Your own post #1 implies...

    How does it not work? Your own post #1 implies that it works, just that you want to do something else.
  11. That's because you're using dataIn as an...

    That's because you're using dataIn as an input/output parameter. I was trying to get you to redesign your program to use it as an input parameter, then provide the output by another way.


    That's...
  12. Your linked list template's retrieve member...

    Your linked list template's retrieve member function should have a const reference parameter instead:

    template <class TYPE>
    bool LinkedList<TYPE>::retrieve(const TYPE &dataIn) const
    The reason...
  13. Replies
    1
    Views
    129

    It looks like your issue is that instead of...

    It looks like your issue is that instead of returning dest, you return (dest + i +j)

    Incidentally, I would rename j to something like dest_len. j makes it look like an index whereas you're using...
  14. You need to include the header file in main.cpp...

    You need to include the header file in main.cpp because to_celsius must be declared before it is called in the main function.

    You don't need to include the header file in temp.cpp in this case,...
  15. Your loop to "delete" the element is concerned...

    Your loop to "delete" the element is concerned with myArr->A[i], whereas your loop to print the array is concerned with myArr[i]. You need to decide which array you're working on. The reason it looks...
  16. Replies
    102
    Views
    2,245

    As I've mentioned before: if you create a suite...

    As I've mentioned before: if you create a suite of unit tests and integration tests and run them frequently after making changes, you would detect such bugs sooner rather than later because your...
  17. I think that by invoking g++ to compile my.c,...

    I think that by invoking g++ to compile my.c, my.c is treated as C++ source rather than C source, so name mangling etc comes into effect without extern "C":

    (Compiling C++ Programs)
  18. Replies
    4
    Views
    261

    A few options come to mind: Convert the C++...

    A few options come to mind:

    Convert the C++ code that you apparently found to C.
    Convert the C watch code that you wrote to C++ (if you're lucky it might already be valid C++)
    Write a C...
  19. Replies
    2
    Views
    234

    I feel that unless you're maintaining a library...

    I feel that unless you're maintaining a library and hence can freely add to its namespace, you probably shouldn't add operators to its interface. The reason is that you're dependent on argument...
  20. Here's a test program that I wrote that allocates...

    Here's a test program that I wrote that allocates the same amount of memory as you are trying to allocate on the stack, assuming sizeof(int) == 4:

    #include <stdio.h>

    int main(void)
    {
    int...
  21. Stack size is typically fairly limited, and here...

    Stack size is typically fairly limited, and here you are asking for 32 MB or so in a single call.

    Do they truly represent global state? If so, then perhaps declaring them global is okay. If not, a...
  22. You may need to use uniform initialisation syntax...

    You may need to use uniform initialisation syntax to get that to compile.
  23. From what I see, you only need two grids: the...

    From what I see, you only need two grids: the source grid and the destination grid. After you have performed the computations to populate the destination grid, you print it etc, and then you copy the...
  24. Two options come to mind: Declare normals in...

    Two options come to mind:

    Declare normals in the class definition (which is what you're already doing) then define and initialise it in exactly one source file rather than in the header (i.e.,...
  25. I wrote a quick program to check that I didn't...

    I wrote a quick program to check that I didn't make some silly mistake:

    #include <stdio.h>

    int main(void)
    {
    unsigned char tableID = 101;
    char expected[14]; // NNN_available
    ...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4