Search:

Type: Posts; User: homer_3

Page 1 of 6 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    3
    Views
    3,978

    I'm running from command line. I know how to set...

    I'm running from command line. I know how to set QUERY_STRING as an env var, but I don't get how the strcmps can work. See the 1st strcmp. It checks to see if Args is exactly equal to "Height". If it...
  2. Replies
    3
    Views
    3,978

    Trouble understanding some open source code

    I'm trying to understand this open source code I found here: http://www.lysator.liu.se/~johol/fwmg/source/WorldMapGenerator.c.

    I cannot figure out how to pass arguments to the program. I know I...
  3. Replies
    7
    Views
    750

    Thanks. Found this write up on that flag....

    Thanks. Found this write up on that flag. https://gcc.gnu.org/wiki/NewWconversion. Unfortunately, my compiler is 4.1 so it seems like I may not have this option.
  4. Replies
    7
    Views
    750

    Shouldn't this give a warning?

    I always forget which one has stricter rules (C or C++) but shouldn't this give a warning in at least one of the languages?



    int x = 120000;
    short y = x;


    I've tried compiling with both c...
  5. Replies
    4
    Views
    1,180

    Your standard cross-platform stuff. The API to do...

    Your standard cross-platform stuff. The API to do something on one platform isn't always the same as the API to do it on the other platform. So FOO is really more like PLATFORM and BAR is more like...
  6. Replies
    4
    Views
    1,180

    Testing if a macro is defined to a value?

    Say I have something lke


    #define FOO BAR

    #if FOO == BAR
    doX();
    #else
    doY();
    #endif
  7. Replies
    26
    Views
    8,216

    I've seen this said a lot too. But I don't see...

    I've seen this said a lot too. But I don't see why using a mutex around accessing a shared resource would help. AFAIK, all using a mutex does is ensure exclusive access to it. But if the compiler...
  8. Replies
    26
    Views
    8,216

    Question about volatile

    I'm trying to figure out if I need to use volatile or not. All of the examples I've seen so far seem to be set up as some small loop is checking the state of a variable to see if it should exit the...
  9. Replies
    3
    Views
    893

    Variadic function weirdness

    I noticed that when using variadic functions, if I pass the va_arg() as parameter to a function, the parameters get passed in reverse. Is that expected?

    For example, the following code outputs

    ...
  10. Replies
    5
    Views
    563

    The unsigned cast of a float. A signed cast works...

    The unsigned cast of a float. A signed cast works ok.
  11. Replies
    5
    Views
    563

    Getting surprising behavior when casting

    I'm trying to cast a float to an unsigned int and getting some surprising behavior.



    float x = -1.0;
    unsigned int y = (unsigned int)x;
    printf("y = %d\n", y);


    The output of this code...
  12. Replies
    3
    Views
    1,203

    So, like usual, even though I spent 45 making my...

    So, like usual, even though I spent 45 making my post and thinking about other ways to solve the issue before posting, it's not until just after I post that I solve the problem. I forgot that...
  13. Replies
    3
    Views
    1,203

    Logging headaches

    Let's say I have a log function



    void my_log(char * msg, unsigned int arg)
    {
    char buf[500];
    snprintf(buf, 500, msg, arg);

    printf(buf);
  14. Replies
    14
    Views
    8,303

    Why do they have to make my life so hard! Thanks...

    Why do they have to make my life so hard! Thanks though, good info to know.

    It looks like smokey has the best solution. I think I can work with that, thanks!
  15. Replies
    14
    Views
    8,303

    Wow, you're upset. I did give a very specific...

    Wow, you're upset. I did give a very specific example. Why would there be an expectation that the example could be changed in order to solve the problem?
  16. Replies
    14
    Views
    8,303

    It'd due to general limitations. I need a way to...

    It'd due to general limitations. I need a way to output some numeric identifier for the class field. The offset from the start of the class seems like the best identifier to me.



    Would be nice,...
  17. Replies
    14
    Views
    8,303

    Finding the "address" of a bitfield

    So I obviously can't take the address of a bitfield, but is there a way to get the address of the field holding the bitfield? What I'm trying to do is find the address of the parent field of a...
  18. So is this implementation defined or maybe just a...

    So is this implementation defined or maybe just a difference between C and C++? My C compiler prints out -1 and -2 where the C++ results in the 31/6. I also thought that the fact that the value is a...
  19. Of course there are enough bits. What makes you...

    Of course there are enough bits. What makes you say there aren't enough bits? 2's compliment works fine with 2 bits or more. 11111 - 1 = 11110. ~11110 = 00001.
  20. 11111 is -1 when converted to int using 2's...

    11111 is -1 when converted to int using 2's complement. Likewise 11110 is -2 when converted to int using 2's complement. This is why I'm confused about the output.



    Yes, exactly. Printing as a...
  21. Getting unexpected outputs for bitfields and floats

    I'm getting unexpected output in 2 different cases. The 1st deals with bitfields. The C++ standard has this line about integral promotions:



    This sounds like the value of a bitfield will always...
  22. Replies
    1
    Views
    900

    Mods, close this thread if you can. I was running...

    Mods, close this thread if you can. I was running this on a fresh install of CentOS and forgot to turn my firewall off! I didn't realize tcpdump could pick up packets before the firewall.
  23. Replies
    1
    Views
    900

    Can't seem to receive UDP packets

    I'm trying to get a UDP server working and just can't seem to get it to read in any UDP packets. I can see the packet coming in on the correct interface and port from tcpdump, but my program never...
  24. Replies
    5
    Views
    3,320

    Actually, I found I was off by a power of 10 in...

    Actually, I found I was off by a power of 10 in my measurement, so it's not as big an issue as I thought.
  25. Replies
    5
    Views
    3,320

    Well crap. After profiling, the map lookup is too...

    Well crap. After profiling, the map lookup is too slow :( So I guess it's back to trying to figure out why what I have crashes.
Results 1 to 25 of 127
Page 1 of 6 1 2 3 4