Search:

Type: Posts; User: MOS-6581

Page 1 of 5 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    12
    Views
    778

    Are there any compilers where you can over align...

    Are there any compilers where you can over align members in a struct (other than the first member)? GCC has __attribute__(aligned(x)) but I'm not sure if that can be applied to the struct members....
  2. Thread: struct

    by MOS-6581
    Replies
    6
    Views
    592

    "f" is a string. Use 'f' if you want a single...

    "f" is a string. Use 'f' if you want a single char.
  3. Replies
    4
    Views
    758

    Callbacks are function pointers: The Function...

    Callbacks are function pointers: The Function Pointer Tutorials - Index
  4. Replies
    12
    Views
    778

    What will actually happen if I compile my library...

    What will actually happen if I compile my library with GCC (64 bit) and then use MSVC to compile the calling code? Let's replace short with long in the above function and assume that we're compiling...
  5. Replies
    12
    Views
    778

    What if you're providing a shared library or a...

    What if you're providing a shared library or a DLL for a particular platform though? You have no control over what compiler the user might be using. I've never seen any requirements that you have to...
  6. Replies
    12
    Views
    778

    I thought about this some more and now I have...

    I thought about this some more and now I have even more doubts. What happens if the basic data types aren't the same size as in the compiler that was used to compile the shared library? For example,...
  7. Replies
    12
    Views
    778

    I was hoping for a solution that would work with...

    I was hoping for a solution that would work with at least all the major compilers like GCC, Clang and VC++. I looked at the #pragma pack directive but that doesn't seem 100% reliable since the...
  8. Replies
    12
    Views
    778

    Structs and unions in shared libraries

    I want to make a shared library that exposes structs and unions that aren't just opaque pointers. Is this portable at all between compilers on the same platform or should I change the design...
  9. Replies
    7
    Views
    1,501

    You usually never deal with DLL files directly in...

    You usually never deal with DLL files directly in your code. You can manually load and unload DLLs if you want to but that is usually done by the linker when you compile your project (in Visual...
  10. Replies
    7
    Views
    2,347

    What do you mean "per desktop"? I read somewhere...

    What do you mean "per desktop"? I read somewhere that each process has it's own lookup table for classes where the HINSTANCE of the module is one field in the table. Something like this:


    Module ...
  11. Replace the function signature like this: int...

    Replace the function signature like this:

    int makeBet(char *choice, int *num)

    You can then call the function like this:

    char choice;
    int num;
    makeBet(&choice, &num);
  12. Replies
    6
    Views
    583

    You're only printing the values in dice1.

    You're only printing the values in dice1.
  13. Replies
    7
    Views
    2,347

    It seems that I had the wrong idea about how...

    It seems that I had the wrong idea about how window class registration in Windows works. The window class you register in a DLL is not shared by all processes that use the DLL so you only need to...
  14. Replies
    7
    Views
    2,347

    I still haven't found a solution to this problem....

    I still haven't found a solution to this problem. This is the documentation for the RegisterClass function:

    https://msdn.microsoft.com/en-us/library/windows/desktop/ms633587(v=vs.85).aspx

    This...
  15. Replies
    2
    Views
    408

    Non-static local variables only occupy memory...

    Non-static local variables only occupy memory when the function is running since they are allocated on the stack. You should be concerned about stack overflow though if you're allocating huge arrays.
  16. Replies
    6
    Views
    1,798

    Check the return value from fwrite and see if you...

    Check the return value from fwrite and see if you get any errors.
  17. Replies
    31
    Views
    5,040

    You can statistically analyze files to determine...

    You can statistically analyze files to determine the encoding but it's not 100% reliable or something you should do yourself. The best way to do it is to just read the file as it is and then have the...
  18. Replies
    7
    Views
    907

    Why do a lot of professors insist on using old...

    Why do a lot of professors insist on using old and outdated software and language standards? Is it because they don't want to put any effort in staying up to date? I would've complained about the...
  19. Post your code. It could be an issue with...

    Post your code. It could be an issue with endianness or similar.
  20. Replies
    7
    Views
    907

    It's a bug that happens when you post code here.

    It's a bug that happens when you post code here.
  21. Replies
    2
    Views
    4,657

    Your file system is most likely case sensitive....

    Your file system is most likely case sensitive. Have you tried "valgrind" instead of "Valgrind"?
  22. Replies
    31
    Views
    5,040

    What's the alternative to fread if you just want...

    What's the alternative to fread if you just want to read sizeof(wchar_t) bytes at a time?
  23. Replies
    31
    Views
    5,040

    I did some testing myself and found some strange...

    I did some testing myself and found some strange results that I can't explain. I first created a simple file in Notepad with the text "Hello" and then saved it as "Unicode". Windows reports that the...
  24. Replies
    31
    Views
    5,040

    Show the entire code. Don't forget to check the...

    Show the entire code. Don't forget to check the return value from functions. It's possible that WideCharToMultiByte is failing for some reason. It returns 0 if it failed.
  25. Replies
    31
    Views
    5,040

    Keep in mind that there's not a one-to-one...

    Keep in mind that there's not a one-to-one mapping between UTF-8 and UTF-16. A character encoded as UTF-16 can take up more or less bytes when converted to UTF-8. To obtain the correct size of the...
Results 1 to 25 of 121
Page 1 of 5 1 2 3 4