Search:

Type: Posts; User: flp1969

Page 1 of 20 1 2 3 4

Search: Search took 0.02 seconds.

  1. 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__ (
    ...
  2. 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...
  3. 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...
  4. 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
  5. Replies
    3
    Views
    332

    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'...
  6. Notice that exec?() WILL return in case of error.

    Notice that exec?() WILL return in case of error.
  7. Replies
    25
    Views
    1,713

    As it should. Simple. Change the code.

    As it should.

    Simple. Change the code.
  8. Replies
    25
    Views
    1,713

    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,...
  9. Beej's Guide to Networking...

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

    0xc41598 = 12850584
  11. Replies
    5
    Views
    463

    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;
    }
    }
  12. Replies
    6
    Views
    722

    Did you tried?

    Did you tried?
  13. Replies
    11
    Views
    639

    And... also, you can use "perror()" to show you...

    And... also, you can use "perror()" to show you the error:


    f = fopen( "c:/file.txt", "w" );
    if ( f == NULL )
    {
    perror( "fopen" );
    return 1;
    }
  14. Replies
    11
    Views
    639

    Ahhh... even on Windows you can use '/', instead...

    Ahhh... even on Windows you can use '/', instead of '\\', in C, as in "c:/file.txt".
  15. Replies
    11
    Views
    639

    Do you have permission to create a file in the...

    Do you have permission to create a file in the root directory of drive C:? Open a prompt and try:

    c:\> echo "hello" > file.txt

    Are you using MSYS? Cygwin?
  16. Google (or Duckduck Go) is your friend: Completly...

    Google (or Duckduck Go) is your friend: Completly fair scheduler
  17. Thread: Word Counting

    by flp1969
    Replies
    10
    Views
    777

    Yep... just to demonstrate the point: "The word...

    Yep... just to demonstrate the point: "The word 'word' is the word.", if not properly dealt with, will give one word of each "The", "the", "'word'", "word" and "word." and "is".
  18. Thread: Word Counting

    by flp1969
    Replies
    10
    Views
    777

    What is a 'word' in this context? Take your text,...

    What is a 'word' in this context? Take your text, above, as an example: punctuation will be considered as part of the 'word' or your files are only lists of words?

    A better approach would be to...
  19. An interesting bug on CLANG (at least in version 11)

    #include <stdio.h>

    static void (*ptr)(void) = NULL;

    void f(void) { puts( "hello" ); }

    void g(void) { ptr = f; }

    int main( void ) { ptr(); }
  20. Replies
    9
    Views
    918

    An interesting bug on GCC 9 and above

    #include <stdio.h>

    int main ( void )
    {
    unsigned int a;
    unsigned int b;
    unsigned int c;

    c = 0;
    for ( a = 0; a < 10; a++ )
  21. Replies
    7
    Views
    541

    And... let's say the first equation is correct......

    And... let's say the first equation is correct... So, you want to calculate a FUNCTION, isn't it? Why not to code a function f()?


    double f(double t)
    {
    return...
  22. Replies
    7
    Views
    541

    Are you sure the equation is correct? 16382

    Are you sure the equation is correct?

    16382
  23. Replies
    20
    Views
    1,286

    Tip, works with GCC, CLANG and Intel C++ Compiler...

    Tip, works with GCC, CLANG and Intel C++ Compiler (but I'm not sure of __attribute__ syntax there... probably __declspec):



    void cleanup_str( char **p ) { free( *p ); }
    ...
    /* Some function...
  24. Replies
    3
    Views
    416

    Read the code again... the result of memcmp is...

    Read the code again... the result of memcmp is being asserted, not if sizeof(data_in)==0
  25. The compiler must know about the identifiers it...

    The compiler must know about the identifiers it is using... So, you can do:

    // file1.c
    int x = 10;

    // main.c

    // The compiler must know that 'x' exists elsewhere!
    extern int x;
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4