Search:

Type: Posts; User: john.c

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds; generated 27 minute(s) ago.

  1. Replies
    7
    Views
    308

    Yes, the reasonable implementation-defined...

    Yes, the reasonable implementation-defined options for a right-shift would be whether it is "arithmetic" or "logical". I'm aware that it works in either case in your situation, but I don't understand...
  2. Replies
    7
    Views
    308

    Since pointers are obviously unsigned integers it...

    Since pointers are obviously unsigned integers it seems logical to store it in an unsigned integer.

    At any rate, right-shifting a signed integer with a negative value (high bit set) is...
  3. Replies
    7
    Views
    308

    Sounds good. Make sure it's an unsigned long,...

    Sounds good. Make sure it's an unsigned long, though. I should have used an unsigned long long in the code I posted. Note that, technically, long is not guaranteed to be 64 bits, although it almost...
  4. Replies
    7
    Views
    308

    #include #include #include...

    #include <stdio.h>
    #include <stdint.h>
    #include <inttypes.h> // this includes stdint.h, too

    int main()
    {
    void *p = &p; // holds address of itself

    // The usual way.
    ...
  5. Replies
    6
    Views
    316

    I forgot to reset the variable arguments for the...

    I forgot to reset the variable arguments for the vfprintf call. It should be:


    void print(const char *fmt, ...) {
    va_list va;
    va_start(va, fmt);

    vprintf(fmt, va);
    ...
  6. Replies
    6
    Views
    316

    _exit() doesn't flush open file buffers. exit()...

    _exit() doesn't flush open file buffers. exit() does.
    You may wish to flush after every line.
    Instead of writing all output twice you could use a function like this:


    void print(const char...
  7. In the 4238-line file, make sure that there is...

    In the 4238-line file, make sure that there is not an extra space before or after the word senator.
  8. I notice that you forgot to initialize k to 0...

    I notice that you forgot to initialize k to 0 before filling your jobs array (which would be better named "jobs" instead of the meaningless "arr"). You are also not testing for end-of-file correctly....
  9. I don't use Windows but maybe you need to...

    I don't use Windows but maybe you need to GlobalFree(hData) before the function returns. And you don't need the double pointer.
    Untested:


    #include <windows.h>
    #include <stdio.h>
    #include...
  10. Replies
    4
    Views
    448

    Think again.

    Think again.
  11. Replies
    1
    Views
    330

    You aren't calling the function, just...

    You aren't calling the function, just "mentioning" the function name, which does nothing.


    #include <stdio.h>

    void foo()
    {
    printf("X\n");
    }
  12. Replies
    4
    Views
    448

    I don't know the problem, but I think it's better...

    I don't know the problem, but I think it's better written like this:


    #include <avr/io.h>
    #include <util/delay.h>

    int main()
    {
    while (1)
    {
  13. Replies
    1
    Views
    255

    wordCountChoice should be an integer, not a char*...

    wordCountChoice should be an integer, not a char* if that's what it is.
    You can convert the string input to an integer with atoi().
    Also note that line 2 above does nothing.
  14. Replies
    9
    Views
    699

    I looked at the generated assembly (with -S) and...

    I looked at the generated assembly (with -S) and it has unrolled the loop, but only for 3 iterations. However, just using -funroll-loops doesn't cause the problem.
  15. Replies
    9
    Views
    699

    -Og enables optimizations that do not interfere...

    -Og enables optimizations that do not interfere with debugging.
    It would not include unrolling loops, which is at least part of what's happening here, albeit incorrectly.
  16. Replies
    9
    Views
    699

    Very strange. You can even start c at 1000....

    Very strange. You can even start c at 1000. Interesting how changing unsigned to int fixes it.


    #include <stdio.h>

    int main()
    {
    unsigned a, b, c = 1000;

    for (a = 0; a < 5; ++a)
  17. The point is that you didn't mention the other...

    The point is that you didn't mention the other post in your question. Someone might have wasted their time helping you when you had already received an answer at the other site.

    BTW, it seems that...
  18. Replies
    17
    Views
    1,432

    That's idiotic. You should crank it up at least...

    That's idiotic. You should crank it up at least as high as -Wall -Wextra -Wpedantic. In fact you can add more, such as -Wshadow to detect shadowing a variable, a common beginner mistake (although...
  19. Don't try to debug the windows header files!...

    Don't try to debug the windows header files!
    Presumably you forgot to include <windows.h> or something.
    If GUID is defined, then the definitions you are missing are:


    typedef GUID IID;
    typedef...
  20. Thread: Unions...

    by john.c
    Replies
    8
    Views
    1,019

    If that's true then why did you show something...

    If that's true then why did you show something different?
  21. Replies
    37
    Views
    2,533

    I doubt that very much. You are clearly a...

    I doubt that very much. You are clearly a braindead moron. :cool:
  22. x is supposed to be an integer, and presumably...

    x is supposed to be an integer, and presumably positive even though it doesn't specify.
  23. What are you babbling about? Don't tell people...

    What are you babbling about? Don't tell people what they can and can't do. You're just a guest here.

    (BTW, the "Reply With Quote" button worked this time, but it sometimes doesn't.)
  24. It seems well-defined to me, although (x - (x -...

    It seems well-defined to me, although (x - (x - 1)) is a strange way to write 1. And the answer for x=5 is not 13.333334 but 13.3333333... (so no possibility of rounding up to a 4, really).

    This...
  25. Replies
    11
    Views
    923

    This sounds totally idiotic. You really don't...

    This sounds totally idiotic.
    You really don't seem to know what you're talking about (and I know assembly quite well).
    Forget I said anything.
Results 1 to 25 of 499
Page 1 of 20 1 2 3 4