Search:

Type: Posts; User: flp1969

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    4
    Views
    177

    Take a look at line 18

    Take a look at line 18
  2. Replies
    17
    Views
    493

    Hehehe... I see both of us enjoy IOCCC: ...

    Hehehe... I see both of us enjoy IOCCC:

    Compile with a simple 'gcc -o http http.c'



    #include/* micro HTTP server */<stdio.h>
    #include/* usage:...
  3. Replies
    17
    Views
    493

    Hehehe... I see both of us enjoy IOCCC: ...

    Hehehe... I see both of us enjoy IOCCC:

    Compile with a simple 'gcc -o http http.c'


    //
    #include/* micro HTTP server */<stdio.h>
    #include/* usage:...
  4. Replies
    17
    Views
    493

    Hehehe... I see both of us enjoy IOCCC: ...

    Hehehe... I see both of us enjoy IOCCC:

    Compile with a simple 'gcc -o http http.c'


    #include/* micro HTTP server */<stdio.h>
    #include/* usage: ./http...
  5. Replies
    17
    Views
    493

    Ok... the first is the same as the second. But I...

    Ok... the first is the same as the second. But I fail to see why pointer arithmetic and indirection, plus pos-increment are "obfuscation". To me, obfuscation is this:

    /* ball.c */
    /* Compile...
  6. Replies
    17
    Views
    493

    Let's see: #include //...

    Let's see:

    #include <stddef.h>

    // "unobscured" code.
    void fill( int *p, size_t elems )
    {
    int i;

    p[0] = 1;
  7. Replies
    17
    Views
    493

    Instead of copying the previous item of the array...

    Instead of copying the previous item of the array adding 2, this is, actually, faster:


    void fillodd( int *p, size_t elems )
    {
    int q = 1;
    while ( elems-- )
    *p++ = 2*q++ + 1;
    }
  8. 0 isn't a number? Let's say we have 0.382: ...

    0 isn't a number?

    Let's say we have 0.382:


    x = log10(fabs(0.382)); // x = -0.417937
    return x >= 0 ? x + 1 : 1; // 1

    There is 1 integral algarism there: 0.
  9. If you are refering to fabs() it's not a function...

    If you are refering to fabs() it's not a function call, since the only thing this function does is to zero the msb. floor() can be avoided, since we are only truncating a positive value:

    #include...
  10. john, you are absolutely right! I thought about...

    john, you are absolutely right! I thought about using floor later... ;)

    []s
    Fred
  11. Just a thought: unsigned int intdigits(...

    Just a thought:


    unsigned int intdigits( double x ) { x = log10(fabs(x)); if ( x < 0.0 ) return 1; else return ceil(x); }
  12. What happens if val is negative?

    What happens if val is negative?
  13. Also, the function name is the entry point...

    Also, the function name is the entry point address, so you can drop the & and * operators:


    ...
    void (*fp)(void) = foo;

    fp();
    ...
  14. And change your scanf to scanf( "%d %d",...

    And change your scanf to


    scanf( "%d %d", &a, &b );
  15. An example without using functions from libc: ...

    An example without using functions from libc:

    static inline void putstr( const void *ptr, unsigned int size )
    {
    // x86-64:
    // OBS: `syscall` can clobber RCX!
    __asm__ __volatile__ (
    ...
  16. If you want some papers to study some refined...

    If you want some papers to study some refined algorithms for floating point printing. Here are some:

    RyŁ - Fast Float-to-String Conversion
    Printing Floating-Point Numbers Accurately with Integers...
  17. The algorithms are complicated. Keep in mind that...

    The algorithms are complicated. Keep in mind that floating point structure, in modern computers, follow the IEEE 754 model, where the value is stored as 3 unsigned integers following not ONE but TWO...
  18. Can't find, now, the actual reference on make...

    Can't find, now, the actual reference on make manual, but uninitialized variables aren't exported:

    # Makefile

    #X=1
    export X

    all:
    make -f Makefile.2
  19. Replies
    3
    Views
    492

    As always, john.c codes are flawless. But I would...

    As always, john.c codes are flawless. But I would insert two more checks on encrypt() - to see if both files are different and to see if the output file was opened. Consider the case where 'text.txt'...
  20. Notice that exec?() WILL return in case of error.

    Notice that exec?() WILL return in case of error.
  21. Replies
    25
    Views
    2,067

    As it should. Simple. Change the code.

    As it should.

    Simple. Change the code.
  22. Replies
    25
    Views
    2,067

    Why "reverse" the buffer if you can fill it...

    Why "reverse" the buffer if you can fill it backwards?


    #include <stdio.h>

    static int digits10( unsigned int n )
    {
    static const unsigned int vals[] =
    { 10U, 100U, 1000U, 10000U,...
  23. Beej's Guide to Networking...

    Beej's Guide to Networking
  24. 0xc41598 = 12850584

    0xc41598 = 12850584
  25. Replies
    5
    Views
    656

    static void arrayShiftLeft( int *arr, size_t...

    static void arrayShiftLeft( int *arr, size_t nelems )
    {
    if ( nelems )
    {
    int tmp = *arr;
    memmove( arr, arr+1, (nelems - 1)*sizeof *arr );
    arr[nelems - 1] = tmp;
    }
    }
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4