Search:

Type: Posts; User: christop

Page 1 of 20 1 2 3 4

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

  1. The char data type is not defined as either...

    The char data type is not defined as either signed as unsigned. It's implementation defined whether it's signed or unsigned by default.

    And ASCII defines only 128 characters (0 through 127). There...
  2. A short must be at least 16 bits wide, per the...

    A short must be at least 16 bits wide, per the minimum range that Salem graciously posted for us (the range allows for 1's complement which "wastes" one bit pattern on negative zero (though whether...
  3. Which means that all integer types could be 64...

    Which means that all integer types could be 64 bits wide (e.g., on an esoteric system that can handle only 64-bit values) and it would still be C standard conforming.

    But most modern systems (x86,...
  4. Replies
    5
    Views
    2,958

    It's not so much how the CPU would do it (some...

    It's not so much how the CPU would do it (some CPUs might round down for division of a negative numerator) but how the C standards define it. The designers of C could have instead defined the integer...
  5. Yep, this is one of the shortcomings/limitations...

    Yep, this is one of the shortcomings/limitations of C.

    C++ has two overloaded versions of strstr, one that takes and returns const char * and the other that takes and returns a non-const char *. C...
  6. Replies
    12
    Views
    2,582

    Yeah, it really can be as big as 100x or more....

    Yeah, it really can be as big as 100x or more. Reading/writing data structures that are already within a process's memory is fast (nanoseconds), but it takes a lot more time (maybe tens of...
  7. Replies
    12
    Views
    2,582

    Keep in mind that, since they're system calls,...

    Keep in mind that, since they're system calls, mmap and sbrk have far more overhead (like 100x) than the little bit of overhead of bookkeeping that libc and the like have to do. The reason that libc...
  8. I think _CRT_glob is specifically for MinGW....

    I think _CRT_glob is specifically for MinGW. Other compilers may have different methods to disable wildcard expansion.
  9. Ah, I guess it depends on how it's built. The...

    Ah, I guess it depends on how it's built. The arguments are passed as-is, but the program can expand them before main if it so chooses. Per Expanding wildcard arguments | Microsoft Docs:



    I...
  10. Replies
    7
    Views
    1,010

    Plus a plain numeric-only phone number might not...

    Plus a plain numeric-only phone number might not even fit in an int, such as one in the 408 area code (4081234567). With 32-bit int, that may get stored as a large negative number (4081234567 may be...
  11. It still applies to CMD running on the latest...

    It still applies to CMD running on the latest versions of Windows.

    Microsoft is (in)famous for maintaining backwards compatibility with even things that many people consider to be misfeatures or...
  12. Not so with MS-DOS. Programs received the...

    Not so with MS-DOS. Programs received the wildcard pattern as-is. That's the only way that commands like xcopy a:*.* /s could even work--the shell (CMD) passes a:*.* to the xcopy program, and the...
  13. Replies
    13
    Views
    2,597

    It's fine if it chokes on NULL. The standard...

    It's fine if it chokes on NULL. The standard strcmp requires non-null arguments and is not guaranteed to work if one or both arguments are null (in fact, the behavior is undefined in those cases).
    ...
  14. Replies
    4
    Views
    693

    Could you instead use an index variable (let's...

    Could you instead use an index variable (let's call it i as an example) that you use in each member, e.g., SensorData.Vbias[0][i], SensorData.SiPMCurrent[0][i], etc.? Without more information on...
  15. I don't know exactly what you mean by "decent",...

    I don't know exactly what you mean by "decent", but the answers you've been given have already exceeded the effort that you've shown to solving it or doing anything with what you've been given.

    ...
  16. Solution: declare 'hwnd' and assign to it the...

    Solution: declare 'hwnd' and assign to it the handle of the window you want to modify. Only you have the source code so only you know what window you want to remove the close button from.
  17. Replies
    8
    Views
    1,571

    I don't see any strong reason to use uint8_t for...

    I don't see any strong reason to use uint8_t for LSB_BIT. You could change it to unsigned and then use %u for the scanf format. You wouldn't even have to make any other changes in your code.
  18. Thread: typedef

    by christop
    Replies
    7
    Views
    1,689

    I'm no expert on typedef, but this code: ...

    I'm no expert on typedef, but this code:



    typedef int *iptr;
    typedef const int *ciptr;

    const int foo = 42;
    const iptr p1 = &foo;
    ciptr p2 = &foo;
  19. Replies
    3
    Views
    680

    Is this a homework assignment? If not, where is...

    Is this a homework assignment? If not, where is this code from? If it came from a book or web site, you'd think it would explain type casting and show code like that as an example.
  20. Replies
    3
    Views
    527

    1. I'm not sure where you got the recommendation...

    1. I'm not sure where you got the recommendation to read one byte at a time with the "read" system call. It's very common to read a large buffer full at a time to minimize overhead (system calls are...
  21. Yes, but with some caveats (e.g., you can't name...

    Yes, but with some caveats (e.g., you can't name a variable "new").


    No, that's not a valid identifier name. All identifiers must begin with an underscore or letter and can be followed by...
  22. Replies
    6
    Views
    794

    Why would you expect *ptr = 2002? Nothing...

    Why would you expect *ptr = 2002? Nothing increments the value that ptr points at. What your latest code is doing is incrementing the pointer ptr itself so that it points at some other, invalid...
  23. In the tm structure, the tm_year field is the...

    In the tm structure, the tm_year field is the year minus 1900, so a value of 70 is 1970, which is the Unix epoch. Not so odd after all (well, I guess you could say the Unix epoch of 1970 was an odd...
  24. Replies
    8
    Views
    954

    Can you show the code that uses interrupts? What...

    Can you show the code that uses interrupts? What platform is that for where you can use interrupts directly anyway? From what I can see, this library is only for Linux and Windows, and in those...
  25. Replies
    4
    Views
    678

    My guess is you were just lucky. Most memory...

    My guess is you were just lucky. Most memory allocators will typically allocate a somewhat larger block than you request (to keep memory blocks aligned), so you were probably writing into that extra...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4