OK but the purpose is to avoid checking the handle type for every line read. Granted, one could use '((DWORD_PTR)h) & 3 == 3' instead of GetConsoleMode or similar function. (there's currently code like "BOOL is_console = GetConsoleMode(...); ...; while WCMD_fgets(..., is_console)" and the handle type shouldn't change between lines/iterations, so why bother recomputing it every time?)
You're probably not. The compiler will probably inline this function, or at least its return value, since it knows it's guaranteed not to change. Please don't do the compiler's work for it: IMHO, it's more readable to make an inline function to determine whether the handle is a console handle. --Juan