Search:

Type: Posts; User: john.c

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    16
    Views
    432

    What do you mean? snprintf() always returns the...

    What do you mean? snprintf() always returns the number of characters that were (or would be) written. Why wouldn't it?
  2. Replies
    4
    Views
    238

    You seem to be making a few incorrect...

    You seem to be making a few incorrect assumptions.
    0xff is not the same as "FF".
    "FF" are two 'F' character codes (70 or 0x46 in ascii or utf-8).
    Also, memcmp doesn't compare a single thing a...
  3. Thread: Composition

    by john.c
    Replies
    11
    Views
    741

    I feel like I've seen this somewhere else. If...

    I feel like I've seen this somewhere else. If you've posted on multiple websites you should mention that fact and give the links to your other posts so that people here don't waste their time...
  4. Replies
    7
    Views
    396

    You're not giving enough information to help you....

    You're not giving enough information to help you.
    Post a link to the problem.
  5. Since it's easy to change it to vector I'll...

    Since it's easy to change it to vector<char> I'll leave that to you.
  6. Replies
    7
    Views
    396

    Maybe something like this: { "cmd":...

    Maybe something like this:


    {
    "cmd": "/usr/bin/sh",
    "args": [
    "-c",
    "the command you want to run",
    ],
    "secret": "supersecretpassword"
  7. Replies
    7
    Views
    396

    You found this exact source code and an a.out...

    You found this exact source code and an a.out that you assume is the corresponding executable.
    You believe that you need to create a config.json file with the correct fields.
    So how are we supposed...
  8. Clearly I still have something to learn about...

    Clearly I still have something to learn about guruship. :)
  9. Maybe something like this: #include...

    Maybe something like this:


    #include <iostream>
    #include <string>
    #include <vector>

    using std::cout;
    using std::cin;
    using std::string;
  10. I just realized that the "Initialize map" code...

    I just realized that the "Initialize map" code needs to be after the declarations of row and col! (I must've moved it without testing. :p )
  11. #include #include using...

    #include <iostream>
    #include <vector>

    using std::cout;
    using std::cin;
    using std::vector;

    int main()
    {
    enum { Player='O', MapTile='*', Boulder='@' };
  12. int main() { // Create temporary struct and...

    int main()
    {
    // Create temporary struct and assign to it.
    typedef struct { int a; } x;
    (x){0} = (x){1};

    // Also works for an int.
    (int){0} = 1;
    }
  13. Replies
    11
    Views
    898

    It's a form-based C# program. The rdo......

    It's a form-based C# program. The rdo... variables refer to the state of the radio buttons. The initial 'if' statement has a semicolon at the end (and doesn't seem to do anything).
  14. Replies
    5
    Views
    379

    The pthread mutex system is much more complicated...

    The pthread mutex system is much more complicated and doesn't just spin if it can't aquire a mutex. Instead it (eventually) sleeps. So it depends on the behavior you want. Sleeping allows more...
  15. Replies
    5
    Views
    379

    "Sequentially consistent" memory ordering is the...

    "Sequentially consistent" memory ordering is the most constrained and therefore as "correct" as it gets. It's possible that you could get a performance boost with "relaxed" ordering, but unless you...
  16. Replies
    5
    Views
    379

    It looks reasonable. I don't think TMutex...

    It looks reasonable.

    I don't think TMutex needs to be volatile. It isn't going to be changed by anything outside of the program, and it doesn't need to be volatile just because the function...
  17. Thread: Just starting

    by john.c
    Replies
    17
    Views
    940

    @thmm, Oops! You're right. I must've had C++ on...

    @thmm, Oops! You're right. I must've had C++ on the brain.
    @kid8n1, Ignore my "recommendations". :tongue:
  18. Thread: Just starting

    by john.c
    Replies
    17
    Views
    940

    It's pretty easy to figure out the correct order...

    It's pretty easy to figure out the correct order if you remember that the tests are done in order. So if the first test is for one q and the second is for two, the second will never be reached since...
  19. Thread: Just starting

    by john.c
    Replies
    17
    Views
    940

    Yes. A chain of "if / else if" will result in...

    Yes. A chain of "if / else if" will result in only one of the blocks of code controlled by the if's being executed. For example, the following code will only execute one of the printf statements no...
  20. Thread: Just starting

    by john.c
    Replies
    17
    Views
    940

    The diagram you show is for the string "KQ", but...

    The diagram you show is for the string "KQ", but your code is looking for "QQ".
    But even if you change the code to this


    else if (card_name[0] == 'K' && card_name[1] == 'Q')

    it still won't...
  21. HANDLE hFind; WIN32_FIND_DATA FindFileData; ...

    HANDLE hFind;
    WIN32_FIND_DATA FindFileData;

    if((hFind = FindFirstFile("C:/some/folder/*.txt", &FindFileData)) != INVALID_HANDLE_VALUE){
    do{
    printf("%s\n", FindFileData.cFileName);...
  22. WTF?!

    WTF?!
  23. You turn on optimization with the -O flag. Try...

    You turn on optimization with the -O flag. Try -O2
    (That's the capital letter O.)
  24. Obviously he's running into a stack limit. And...

    Obviously he's running into a stack limit.
    And although tail call optimization is not guaranteed by the standard, any decent compiler will do it.
    But it is not done if you don't request...
  25. Since it's tail recursion, as long as it's...

    Since it's tail recursion, as long as it's optimized only a single stack frame would be used.
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4