Search:

Type: Posts; User: christop

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    11
    Views
    173

    realloc(NULL, size) is exactly the same as...

    realloc(NULL, size) is exactly the same as malloc(size). If you used a compiler that treated them differently, then get a new compiler (I know gcc handles it correctly). I use realloc(NULL, size)...
  2. Does your compiler have warnings enabled? You...

    Does your compiler have warnings enabled? You should have gotten a warning from this line:


    if(check.acc_no = add.acc_no)

    Frankly, there are a lot of problems with this code. For one,...
  3. Replies
    3
    Views
    113

    /bin/sh: glad/glad.h: No such file or directory ...

    /bin/sh: glad/glad.h: No such file or directory

    That's the shell, not the compiler, complaining that it can't find the file glad/glad.h. Do you have the text "glad/glad.h" (or as a result of...
  4. Replies
    72
    Views
    845

    Make it an infinite loop. Dieharder will read as...

    Make it an infinite loop. Dieharder will read as much data as it wants (which is A LOT, or so I've read).
  5. Replies
    72
    Views
    845

    Here's the code I'm testing. I modified flp1969's...

    Here's the code I'm testing. I modified flp1969's code just slightly to produce binary output.

    #include <stdio.h>
    #include <stdlib.h>
    #include <time.h>
    #include <limits.h>

    // using size_t...
  6. Replies
    72
    Views
    845

    It appears so. In any case, the manual gives a...

    It appears so.

    In any case, the manual gives a clear example of the simplest way to test a random-number generator:



    (Just replace "cat /dev/urandom" with "./mcc_rnd_die.elf", and make sure...
  7. Replies
    72
    Views
    845

    I just noticed this part of your dieharder output...

    I just noticed this part of your dieharder output (from 10 hours ago):



    rng_name |rands/second| Seed |
    mt19937| 7.47e+07 |2183355501|


    It looks like dieharder is using...
  8. Thread: C++ Challenge

    by christop
    Replies
    4
    Views
    248

    Yikes! That has O(N) space requirement. In other...

    Yikes! That has O(N) space requirement. In other words, the memory it requires is directly proportional to the length of the list. For example, if your list is 1000000 nodes long and has a loop at...
  9. Replies
    72
    Views
    845

    Is that command doing what you think it does?...

    Is that command doing what you think it does? That command redirects the executable file itself to the standard input of the "dieharder" program. It doesn't execute ./mcc_rnd_die.elf.
  10. Replies
    15
    Views
    367

    By the way, main() returns int, not void. Some...

    By the way, main() returns int, not void. Some 30-plus-year-old compilers like Turbo-C let you get away with it, but it's non-standard.
  11. Replies
    38
    Views
    648

    You can rest assured that incrementing a pointer...

    You can rest assured that incrementing a pointer adds the size of the pointed-to object to the pointer. It's guaranteed by the standards, and it's common practice to use something like ++p to...
  12. Replies
    40
    Views
    1,072

    According to the relevant standard (POSIX), a...

    According to the relevant standard (POSIX), a text file contains zero or more lines of text; each line of text is zero or more characters followed by a single newline character (\n). Put simply,...
  13. Replies
    38
    Views
    648

    Why the obscure code? spot = &(spot[1]) is...

    Why the obscure code? spot = &(spot[1]) is equivalent to ++spot, but the latter is (IMO) easier to read.
  14. It's not. You want to check for an input error,...

    It's not. You want to check for an input error, correct? Checking the return value of sprintf won't do that, but checking the return value of scanf will.
  15. Check the return value of scanf(). It gives you...

    Check the return value of scanf(). It gives you the number of successful conversions.
  16. Replies
    9
    Views
    238

    It's not weird at all. That's how umask works....

    It's not weird at all. That's how umask works. From umask(2) - Linux manual page:
  17. Replies
    2
    Views
    140

    The conventional way is to put declarations in a...

    The conventional way is to put declarations in a header file and definitions in a source file:

    foo.h:


    #ifndef FOO_H
    #define FOO_H

    // declarations
  18. You don't need "extern" on a function...

    You don't need "extern" on a function declaration. Surely you didn't include the function's definition in a header file, right? This is the only part of the function that should be in a header file:...
  19. I haven't read through everything there, but the...

    I haven't read through everything there, but the whole thing about EOF is wrong, to say the least: KernighanRitchieAndSTm32/EndofFile.md at master * akd-jls/KernighanRitchieAndSTm32 * GitHub

    EOF...
  20. Replies
    7
    Views
    415

    Don't they/them/their suffice? They've been...

    Don't they/them/their suffice? They've been acceptable as gender-neutral singular personal pronouns since, oh, the 14th century.
  21. What is your question? What do you need help...

    What is your question? What do you need help with?

    By the way, when I run your code it prints "10", as I would expect.
  22. Replies
    17
    Views
    369

    I wouldn't say it's ruled out. Undefined behavior...

    I wouldn't say it's ruled out. Undefined behavior can show up in any of the following ways:


    The program works as you expected.
    The program crashes.
    The program gives weird results.
    Demons...
  23. Replies
    17
    Views
    369

    That's likely because you used memcpy in an...

    That's likely because you used memcpy in an undefined way (e.g., source and destination overlap). I haven't looked too deeply at your code to see if that's the case, but there's an exceedingly low...
  24. Replies
    8
    Views
    314

    Each case creates two variables, leftweapon and...

    Each case creates two variables, leftweapon and rightweapon, and they both go out of scope outside the switch statement. Define them before the switch statement and only assign to them inside the...
  25. Replies
    7
    Views
    352

    It's not an issue of library version. It's how...

    It's not an issue of library version. It's how the C language works. It's bad to use feof() to control a loop because it's asking the wrong thing. feof() tells you that you have already tried to read...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4