Search:

Type: Posts; User: midyro edellve

Search: Search took 0.01 seconds.

  1. Replies
    3
    Views
    3,295

    Weird endianness related bug

    So, apparently when casting an array of bytes, C automatically reverses the endianness:



    #include <stdio.h>
    #include <stdint.h>

    int main(){
    uint8_t a[4] = {0x52,0x4a,0x75,0xd8};
    ...
  2. Ah, I see. No big problem, I just wanted to see...

    Ah, I see. No big problem, I just wanted to see if it could be done and how. Thanks!
  3. Function pointer array with immediate initalization with nameless functions

    What I'm trying to do is make an array of functions, and initialize it with "anonymous" functions. That is, the function is only defined inside of the array. I currently use an enum to simulate...
  4. Jeez, that was the problem. Thanks!

    Jeez, that was the problem. Thanks!
  5. struct with array of compile-time decided length via macro

    I need something like this:


    #define x 5;

    struct A{
    int array[x];
    };

    void main(void){
  6. Replies
    2
    Views
    3,184

    That's a very awesome trick, thanks! I should...

    That's a very awesome trick, thanks! I should really pick up a book about #defines...

    For those interested, heres my code now (structs have been typedef'ed, as well as some other minor tweaks):
    ...
  7. Replies
    2
    Views
    3,184

    Like templates in C++, but not really

    I have some code that I need to duplicate for several structs, and I don't want to manually copy/paste, then search and replace the words.

    I have a container object, a struct scene, which holds...
Results 1 to 7 of 7