Search:

Type: Posts; User: christop

Page 1 of 20 1 2 3 4

Search: Search took 0.09 seconds.

  1. Replies
    43
    Views
    1,506

    You can also make valid words by removing the...

    You can also make valid words by removing the "s": hip and oar. I don't see the point you're trying to make. "More construct" still doesn't make any sense in English.

    I've found only two online...
  2. You might want to look at a Lisp (Common Lisp,...

    You might want to look at a Lisp (Common Lisp, Scheme, etc.). Those languages have very powerful macro systems which can manipulate code as data (because code is data in Lisp).
  3. Replies
    43
    Views
    1,506

    Doesn't seem applicable with the way you're using...

    Doesn't seem applicable with the way you're using it.
  4. Replies
    43
    Views
    1,506

    Maybe you mean "more compact"?

    Maybe you mean "more compact"?
  5. Replies
    5
    Views
    825

    Unless it's a janky/non-standard compiler, there...

    Unless it's a janky/non-standard compiler, there will be a C runtime that initializes variables with values before main() is called even on embedded systems. That's the case with the most popular C...
  6. Replies
    14
    Views
    817

    What terminal are you using? Mintty or something...

    What terminal are you using? Mintty or something else?

    This might be relevant: ncurses on windows, can't receive KEY_MOUSE
  7. Replies
    7
    Views
    2,953

    The short answer is that it creates a window and...

    The short answer is that it creates a window and then processes messages sent to it. This is a basic skeleton of a Windows application.

    A "message" is something that Windows sends to a window (or...
  8. Replies
    4
    Views
    1,087

    When you do str[0] - '0', I believe the result is...

    When you do str[0] - '0', I believe the result is automatically promoted to an int, and when you send that int value to cout it's converted to its text representation, so you'll see "1", "0", and "3"...
  9. Replies
    24
    Views
    9,472

    Spaces in a file name need to be escaped or...

    Spaces in a file name need to be escaped or quoted when used in a shell. Do you consider spaces to be "unsafe"? Are spaces "special"?



    Why would my age matter? I've been putting spaces in file...
  10. Replies
    24
    Views
    9,472

    OK, but I still don't understand what you mean by...

    OK, but I still don't understand what you mean by "safe". All characters that you might find in a file name are "safe" (otherwise the OS wouldn't have let you use them in a file name in the first...
  11. Replies
    24
    Views
    9,472

    Are you renaming the files themselves, or just...

    Are you renaming the files themselves, or just displaying their names in some sort of user interface? If the former, I'd be careful not to overwrite existing files. For example, if you have two files...
  12. I'm pretty sure delete this in a class's...

    I'm pretty sure delete this in a class's destructor will cause problems. What happens if an instance of the class was statically or automatically allocated? You can't delete it. And if it's...
  13. Replies
    24
    Views
    9,472

    But strspn returns 1 only when the first...

    But strspn returns 1 only when the first character is special and the next character is not special. So strspn("##foo", SPECIAL_CHARS) will return 2.

    strspn and strcspn are the wrong tools for...
  14. Replies
    8
    Views
    5,531

    But that requires that you assume how sem_t is...

    But that requires that you assume how sem_t is defined. POSIX doesn't say how the sem_t structure is defined. A semaphore with a value of 0 might be valid. On the other hand, a null pointer to a...
  15. Replies
    8
    Views
    5,531

    typedef sem_t *npawsem; #define INVALID SEM NULL...

    typedef sem_t *npawsem;
    #define INVALID SEM NULL


    Then make a function to allocate (with malloc() or shmget() or shm_open() or whatever, depending on how it's shared) and initialize (with...
  16. In other words, the compiler you used (GCC?) is...

    In other words, the compiler you used (GCC?) is smart enough to optimize the recursive code to the equivalent to this code:



    int divide(int a)
    {
    if (a > 1) {
    return 1;
    }
    ...
  17. Replies
    27
    Views
    9,731

    Tail call optimization isn't a guaranteed feature...

    Tail call optimization isn't a guaranteed feature of C. Many compilers can do it, but you can't count on it in general.
  18. Replies
    2
    Views
    2,635

    To be clear, (++x)*(++x) is undefined behavior...

    To be clear, (++x)*(++x) is undefined behavior because you cannot modify the same object more than once between sequence points. You can't and shouldn't expect any particular result from undefined...
  19. Replies
    17
    Views
    12,348

    Interesting, and I stand corrected. But it...

    Interesting, and I stand corrected.

    But it seems the C standard implies that char is always one byte, whether it's 8 bits or 16 bits or 32 bits, since the size of every type is measured against...
  20. Replies
    17
    Views
    12,348

    One nitpick: sizeof reports the size of an object...

    One nitpick: sizeof reports the size of an object or type in terms of the size of a char, not bytes. A char is one byte on most platforms, but some platforms may define char as 16 or 32 bits (in...
  21. Replies
    17
    Views
    12,348

    I disagree for the most part. A beginner...

    I disagree for the most part.

    A beginner programmer shouldn't really worry about how big each data type is (they should understand their ranges and when and where to use each type, though). And by...
  22. Replies
    6
    Views
    6,654

    Yeah, that has always irked me. But to be fair to...

    Yeah, that has always irked me. But to be fair to the original stdio designers, they created it long before the convention existed to put the object parameter first.
  23. Replies
    5
    Views
    5,057

    "toupper" (note the "u") is in ctype.h, but...

    "toupper" (note the "u") is in ctype.h, but strchr is in string.h.
  24. Replies
    6
    Views
    6,654

    Since you aren't worried about exactly following...

    Since you aren't worried about exactly following C++ method-calling syntax, why not just call the methods directly without a "method_call" macro?

    So instead of this:



    method_call...
  25. Replies
    17
    Views
    12,348

    What you should do instead of hardcoding the size...

    What you should do instead of hardcoding the size of int as 4 (int is larger or smaller than 4 on some platforms) is to use sizeof (int), or better yet, sizeof array[0]:



    unsigned int size...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4