git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC PATCH v2 2/2] MSVC: Fix an "incompatible pointer types" compiler warning

From
Johannes Sixt <j6t@kdbg.org>
Date
Dec 8, 2009, 20:31 UTC
Message-ID
<200912082131.44498.j6t@kdbg.org>
In-Reply-To
<4B1EAD9A.3090205@ramsay1.demon.co.uk>
On Dienstag, 8. Dezember 2009, Ramsay Jones wrote:
Show 20 quoted lines
>     30	#define stat _stat64
>     31	int mingw_lstat(const char *file_name, struct stat *buf);
>     32	int mingw_fstat(int fd, struct stat *buf);
>     33	#define fstat mingw_fstat
>     34	#define lstat mingw_lstat
>     35	#define _stat64(x,y) mingw_lstat(x,y)
>     36	#define ALREADY_DECLARED_STAT_FUNCS
>     37
>     38	#include "compat/mingw.h"
>     39
>     40	#undef ALREADY_DECLARED_STAT_FUNCS
>
> This works fine, *provided* you do not need to compile with
> -D_USE_32BIT_TIME_T, which would produce this warning:
>
>     ...mingw.c(223) : warning C4133: 'function' : incompatible types - \
>     from '_stat64 *' to '_stat32i64 *'
>
> This would actually be *worse* than the original code, since the struct
> _stat64 would not have the same "shape" as the struct _stat32i64; ...

To cut this short: According to your explanations, using -D_USE_32BIT_TIME_T with MSVC is bad. Please reroll without references to _USE_32BIT_TIME_T.

-- Hannes
Previous: Ramsay JonesNext: Ramsay Jones
Message 4 of 6 in “MSVC: Fix an "incompatible pointer types" compiler warning”
  1. 2/2 MSVC: Fix an "incompatible pointer types" compiler warningRamsay Jones, Dec 4, 2009
  2. Johannes SixtDec 5, 2009
  3. Ramsay JonesDec 8, 2009
  4. Johannes SixtDec 8, 2009
  5. Ramsay JonesDec 10, 2009
  6. Johannes SchindelinDec 5, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.