Search:

Type: Posts; User: flp1969

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    4
    Views
    607

    This will overflow: u_int64_t...

    This will overflow:

    u_int64_t filesize_in_bytes = channels * bytes_per_sample * samples_per_second * duration_in_second;

    Example:


    #include <stdio.h>
    #include <stdint.h>
    #include...
  2. Replies
    3
    Views
    692

    Assuming this "string" is a MAC address (6...

    Assuming this "string" is a MAC address (6 bytes):


    union {
    unsigned int dw;
    unsigned char b[8];
    } u = { 0 };

    // str points to string...
    if ( sscanf( str,...
  3. Probably call *__imp_MessageBoxA(%%rip).

    Probably call *__imp_MessageBoxA(%%rip).
  4. No... the thread id isn't a pointer per se. Look...

    No... the thread id isn't a pointer per se. Look at the example. The thread id is a value returned by pthread_create (pointed in the first argument) and isn't sequential as in 0,1,2,3...!

    If you...
  5. Lots of error assuming wrong things: 1 - Each...

    Lots of error assuming wrong things:

    1 - Each time pthread_create is called it can fail (return a value different of 0);
    2 - Thread ID isn't a sequential value. It can be anything;
    3 - A pointer...
  6. mov eax,0x10 isn't, let's say, mov al,0x10,...

    mov eax,0x10 isn't, let's say, mov al,0x10, because, in x86-64 mode, updating 32 bits aliases (E??) of 64 bits registers (R??) automatically zero the upper 32 bits (See Intel SDM or AMD development...
  7. NASM "optimizes" some instructions... Example,...

    NASM "optimizes" some instructions... Example, sometimes xor rax,rax is optimized to xor eax,eax (do the same, but smaller). GAS isn't an optimizing assembler..
    I prefer NASM because of this and it...
  8. I didn't say ALL instructions opcodes are...

    I didn't say ALL instructions opcodes are different...
  9. There are some differences between 32 bits code...

    There are some differences between 32 bits code and 64 bits code... For example:


    0x40 - inc eax ; i386
    0xFF 0xC0 - inc eax ; x86_64
    In x86-64 mode 0x4x is a REX prefix,...
  10. Replies
    6
    Views
    1,269

    My policy: In case of doubt, DRAW! 16473

    My policy: In case of doubt, DRAW!

    16473
  11. Replies
    11
    Views
    1,169

    I suppose that these "sensors" are lasers which...

    I suppose that these "sensors" are lasers which have the beam interrupted by the object... But this isn't a good project and something is missing... with 6 pilars you should have 5 sensors:


    ->...
  12. Replies
    11
    Views
    1,169

    Let say your sensors are connected to bits 0 to 2...

    Let say your sensors are connected to bits 0 to 2 of a register called IR:

    // Do something... (here I'll pass sensors data to the functions).
    extern void not_in_weightbridge(unsigned int);...
  13. Replies
    6
    Views
    630

    "C only knows about binary at the machine level"...

    "C only knows about binary at the machine level" means: There is no "decimal format"!
  14. Replies
    5
    Views
    21,685

    Use 'statvfs' syscall.

    Use 'statvfs' syscall.
  15. And, clock() doesn't measure cpu clock cycles.

    And, clock() doesn't measure cpu clock cycles.
  16. Let me understand this: You want to do a GUI...

    Let me understand this: You want to do a GUI application for a keyboard because you want to use the mouse instead of pressing keys?
  17. AND... local objects aren't initialized to zero...

    AND... local objects aren't initialized to zero by default... Only static local objects OR global objects... This:


    int a[10]; // local
    Isn't initialized... This:


    int a[10] = { 0 }; ...
  18. And, NO... this: int f( ... ) { int b = 0;...

    And, NO... this:

    int f( ... )
    {
    int b = 0;
    ...
    }
    Here b is initialized at RUNTIME because it is on stack OR in a register...
    The compiler can discard this object only if the...
  19. I don't get where you are trying to reach......

    I don't get where you are trying to reach... this:

    int f( ... )
    {
    int a[10];
    int n;

    n = g( a );
    if ( ! n )
    return 0;
  20. Replies
    8
    Views
    1,293

    Yep, but it is nice to know that multi byte...

    Yep, but it is nice to know that multi byte charsets can be traced back to Dennis Ritchie and Ken Thompson in the 70's (UNICODE was designed based on experiences made by XEROX in the 80's -- as...
  21. Replies
    8
    Views
    1,293

    There are routines in wchar.h to convert to/from...

    There are routines in wchar.h to convert to/from wchar_t to/from local charset, but you have to set locale properly, typically:


    setlocale( LC_ALL, "" );
  22. Replies
    8
    Views
    1,293

    Well... working with single byte charsets isn't a...

    Well... working with single byte charsets isn't a real problem with portability... nowadays we have a difficult one: In Windows you can work with WINDOWS-1252 charset (a modified ISO-88591-1 charset)...
  23. A small correction: void...

    A small correction:



    void voltage(t_SenseDataRaw *k, float *adv) {
    uint16_t *p = &k->Vbias; // the first member (A pointer!).
    for (int i = 0; i < 4; i++)
    adv[i] = p[i] * 3.3...
  24. Simplier: // Circular single linked list...

    Simplier:



    // Circular single linked list test.

    #include <stdio.h>
    #include <stdlib.h>

    // Macro to initialize a list.
  25. Replies
    5
    Views
    1,224

    AND... free works (do nothing) if the pointer is...

    AND... free works (do nothing) if the pointer is NULL (ISO 9899 7.20.3.2 2)... But if the pointer isn't NULL and not allocated by the functions above, then the behavior is unspecified (probably a...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4