« first day (1194 days earlier)      last day (1650 days later) » 

12:13 PM
vis[x][y]==1 is never runned?
:47606530
I wonder why a lot of c headers are actually included in c++ headers, and why not just c headers directly?
 
@DexterLiu not sure what you mean by this?
 
for example, <limits.h> is included in <climits> and <climits> is included in <limits>, if I just wanna use several macros of MAX values, why not just include <limits.h> in my source file? isn't it less dependency?
 
the standard dictates that the C functions are in the std:: namespace, the non-namespaced functions are optional per standard
the C++ standard that is
 
12:29 PM
so what is good about putting them in std:: ?
 
@DexterLiu I'd suggest using std::numeric_limits to avoid some odd type issues
 
why is it better?
 
@DexterLiu in theory to prevent namespace pollution
 
I don't quite know, what is namespace poluttion. If I just use a INT_MAX from <limits.h>, what will it afffect?
And is there really a namespace for the macros in <limits.h>? I think they are just plain macros, they are not in any namespace..
 
no, macros are obviously not affected by namespaces
you asked why the nested includes and I answered why, because the standard is worded in a way that basically requires it
 
12:36 PM
OK. that was a general question. But for a specific case, if I want to use INT_MAX, can I just simply include <limits.h>?
Becuase in the <limits.h>, there are only macros, nothing else
 
sure, you can. I think they're "deprecated" per the C++ standard, but there's not much reason to remove it, so it'll be safe for a while at least
 
12:51 PM
@DexterLiu you can, an implementation is not required to provide them though. Moreover the macros have some odd type issues. Hence my recommendation to avoid them
 
you mean macro is not type safe?
 
@DexterLiu not only not type safe, but may not be interpreted the way you intend. Those macros are generally safe for comparison use.. but not much else unless you're really careful
This is why std::numeric_limits exists
 
1:52 PM
That is good point!
I dont get it, why microsoft has different different typedef for the same data type.
typedef unsigned long DWORD;
typedef unsigned long ULONG;
 
@DexterLiu different architectures?
 
even if it's not for different architectures it's still reasonable to try and seperate types semantically.
 
why it is reasonable to sepearate, even if they are on same architecture? they are both unsigned long
 
@DexterLiu different purposes. DWORD is usually very processor specific. ULONG is intended as a more sized type
 
different types can help you communicate intend and if strongly typed even type-check. E.g. "void calculateAcceleration(int time, int speed)" versus "void calculateAcceleration(seconds_t time, meterpersecond_t speed)".
 
2:05 PM
exactly DWORD is not intended to be a count in most cases
 
@Mgetz But in the document, it says, DWORD is a 32-bit unsigned integer, how can it be processor specific?
 
@DexterLiu because the document is wrong?
 
well DWORD is a 32-bit unsigned integer, but who says "unsigned long" is always a 32-bit unsigned integer
 
yeah. you are right.
Then, they should not be defined the same. So the <minwindef.h> is wrong too?
They are all defined in <minwindef.h>
 
why not, if they're the same on the platform the SDK is targeting? If you change platform you only need to change in that one place
 
2:16 PM
So you mean for different SDK, the header file changes also?
 
it could. It doesn't matter whether it does or not (no clue how that header looked for itanium/MIPS/Win CE, etc). It gave them the flexibility to potentially treat the Win32/Win64 transition differently, most platforms went ILP64, but Microsoft wen LLP64.
because gcc and msvc deal with it differently
 
 
4 hours later…
6:38 PM
what the hell is this?
    LSTATUS RegQueryValueExW(
      HKEY    hKey,
      LPCWSTR lpValueName,
      LPDWORD lpReserved,
      LPDWORD lpType,
      LPBYTE  lpData,
      LPDWORD lpcbData
    );
The lpType is a pointer to Registry value type, which is macro. how can I get a pointer to macro? this is so weird..
I have to first have a DWORD type = REG_DWORD and then pass &type to the function
this is not ok
 
@DexterLiu Yes, it is okay. That's an out variable. You're querying a value, and that tells you the type of the value you queried. You look for something named "foo", and that tells you that this particular foo is a REG_DWORD, so you know how to interpret the data that gets returned in lpData.
 
my bad. It is out.
xD
 
6:58 PM
I feel so crazy, I am rewriting some WIN APIs. Although I do not know what is inside of these WIN API..
What I know is, there is NT API called inside. and I rewrite/guess?? the logic between them.
 
 
3 hours later…
9:50 PM
@DexterLiu You can always just step into them with a debugger or just do what I do most of the times, just look at what ReactOS does. Since they apparently stole the source anyway, hehe
 

« first day (1194 days earlier)      last day (1650 days later) »