Search:

Type: Posts; User: Hodor

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    11
    Views
    155

    Might be best to use that for now and after the...

    Might be best to use that for now and after the bugs are sorted out then move to using lua_newstate (if you have to)
  2. Replies
    11
    Views
    155

    But... you don't trust realloc()? Also,...

    But... you don't trust realloc()?

    Also, you're not passing any errors back to your functions, you're passing them back to Lua. The function needs to behave exactly how Lua expects and it doesn't...
  3. Replies
    11
    Views
    155

    You need to write a minimal test case that...

    You need to write a minimal test case that exhibits the unexpected behaviour. It seems unlikely anybody can help with a code dump of thousands of lines of barely legible uncommented code pulling in a...
  4. Replies
    6
    Views
    165

    If your requirement is 0xA0 after the shift then...

    If your requirement is 0xA0 after the shift then perhaps you should be writing unsigned char c = 0x0A; // (no single quotes etc necessary)
  5. Replies
    5
    Views
    152

    Ah, I see. I was kind of wondering why it was...

    Ah, I see. I was kind of wondering why it was returning head. Thanks

    Edit: kind of annoying to have to remember to always have list = in the calling function though
  6. Replies
    59
    Views
    1,267

    Some interesting reading as well (second link)....

    Some interesting reading as well (second link). In the second link scroll down to look at the graphs and read the discussion. Also worth reading is the section called "how hard are the problems?...
  7. Replies
    59
    Views
    1,267

    That only solves the simple where: a) the cycle...

    That only solves the simple where: a) the cycle length is 1; and b) the cycle repeats. It doesn't deal with input like



    initial state ".#."
    patterns
    "....#"
    "#...."
  8. Replies
    5
    Views
    152

    Not tested, but the below should work. Most of...

    Not tested, but the below should work. Most of the comments are straight from the wikipedia pseudocode but I added a few. I suspect that Wikipedia uses the pseudo-c so that it's more language...
  9. Replies
    11
    Views
    155

    It loads libraries like the docs say in my own...

    It loads libraries like the docs say in my own code. What do you mean by "lua is not loading libraries as the docs describe"?
  10. No worries. Perhaps I'm being overly pedantic...

    No worries. Perhaps I'm being overly pedantic because it's unlikely that the OP is compiling on an architecture with 12 bit bytes (it doesn't look like an embedded program which is where you're most...
  11. Cool. As for the CHAR_BIT, I don't think I'm...

    Cool.

    As for the CHAR_BIT, I don't think I'm interpreting things incorrectly. Section 6.2.6.1p4 of C11 says "Values stored in non-bit-field objects of any other object type consist of n x CHAR_BIT...
  12. If you're doing this as a self learning exercise...

    If you're doing this as a self learning exercise my suggestion would be to find a better website or book. The code above and all the code on the codewithc website that I looked at is horrific. I'm...
  13. Edit: Huh,...

    Edit:
    Huh, https://cboard.cprogramming.com/c-programming/177810-storing-structure-data-txt-file-instead-dat-file-post1288078.html?highlight=#post1288078

    Been working on this same problem for 7...
  14. I doubt the code I highlighted in bold is...

    I doubt the code I highlighted in bold is correct. Without seeing how things are being used I'd say that it's more likely that it should be



    if (needed > *capacity - 1) {


    Assuming you're...
  15. I don't know what I'd do. On something with FPU...

    I don't know what I'd do. On something with FPU I'd probably just leave it as



    pow(2, ceil(log2(needed)))


    or use one of the bit twiddling approaches until profiling indicated that I...
  16. You need to turn warnings on. char Hero1=...

    You need to turn warnings on.



    char Hero1= "Batman";

    How many characters can Hero1 hold?
  17. I think there is a typo here: Should really...

    I think there is a typo here:


    Should really be using __builtin_clzll otherwise the calculation will be incorrect. Also, I believe, that sizeof(size_t) should be multiplied to get the number of...
  18. Replies
    72
    Views
    821

    Thanks. That's what I thought but wasn't sure

    Thanks. That's what I thought but wasn't sure
  19. Replies
    72
    Views
    821

    Knuth gives pseudocode or code in the MIX or MMIX...

    Knuth gives pseudocode or code in the MIX or MMIX language (which both have assemblers... MIX or MMIX depends on what revision of his books you look at) or both. So volume 2 and the stuff about...
  20. I'd probably leave the skip leading whitespace...

    I'd probably leave the skip leading whitespace part in... just in case

    Yeah what you've written is what it's doing, basically. I'd write it as below but I I think you've got the gist of it

    1....
  21. Seems a bit clumsy but it works (*shrug*). Note...

    Seems a bit clumsy but it works (*shrug*). Note that it will not work if there are spaces in the column name



    #include <stdio.h>
    #include <ctype.h>

    int countcolumns (const char *s);
    ...
  22. One way might be to write a function int...

    One way might be to write a function



    int countcolumns (const char *s)
    {
    int columns = 0;

    while (isspace(*s)) // Skip leading whitespace
    s++; // Go to next...
  23. Replies
    72
    Views
    821

    Why not use Mersenne Twister? Its behaviour is...

    Why not use Mersenne Twister? Its behaviour is known, and mathematically proven, and it's easy to implement. The paper and reference implementation can be found here: Mersenne Twister: A random...
  24. Thread: STL problems

    by Hodor
    Replies
    4
    Views
    220

    For my installation of g++ it's getting included...

    For my installation of g++ it's getting included by /usr/include/c++/9/bits/char_traits.h (which is #including stl_algobase.h which is where max/min are for my installation; <algorithm> #includes...
  25. Replies
    59
    Views
    1,267

    That quick?! Wow, cool. Every now and then you...

    That quick?! Wow, cool. Every now and then you read something that changes your outlook on things. I can't promise that the book will do that for you, but it did for me. I hope you enjoy it
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4