Hi Richard, I'm not sure I understand where the need for sizeof(TYPE) to equal sizeof(char *) is coming from and how that affected 64bit Windows and libregex. Was there a compilation error, a runtime crash, something else entirely?
As for size_t, c99 defines that type very minimally. It is ONLY required to be an unsigned integral type capable of holding a value from 0 to 65536. On a platform with 16-bit bytes, that might mean sizeof(char)==sizeof(size_t). On other platforms, that might be something else entirely. There is nothing that requires sizeof(size_t) to be equal to the size of any pointer type. A type that DOES have the property you describe is the c99 optional uintptr_t type. That's defined as an unsigned integral type capable of holding any valid pointer to void. There's still no guarantee that sizeof(uintptr_t)==sizeof(void*), but for all practical purposes it will almost certainly be equal or greater in size. Cheers! Sean On Jun 15, 2012, at 4:37 PM, Weiss, Richard A CIV (US) wrote: > The file regexec.c includes engine.c twice where the data types changed > between the versions. To make this work the sizeof(long) must equal > sizeof(char *) which it is not on Win64. The easiest solution was to change > all the places where 'long' and 'unsigned long' were used to the 'size_t' and > 'ssize_t' since sizeof(char *) and sizeof(size_t) are always equal. > > > > -----Original Message----- > From: Christopher Sean Morrison [mailto:[email protected]] > Sent: Friday, June 15, 2012 3:42 PM > To: [email protected] > Subject: Re: [brlcad-commits] SF.net SVN: brlcad:[51054] > brlcad/trunk/src/other/libregex > > > On Jun 10, 2012, at 3:17 PM, [email protected] wrote: > >> Revision: 51054 >> http://brlcad.svn.sourceforge.net/brlcad/?rev=51054&view=rev >> Author: r_weiss >> Date: 2012-06-10 19:17:42 +0000 (Sun, 10 Jun 2012) >> Log Message: >> ----------- >> Updates to libregex to allow the mged/archer 'red' command to work on 64bit >> windows. Updated files in 'src/other/libregex/' ... 'regex.h' 'regex2.h' >> 'regexec.c' and 'engine.c'. > > Richard, can you provide any more background details on how red/regex was > behaving that led to changing it? I don't have a win64 to test on at the > moment, but am worried that the typedef changes introduces bugs (due to > bitwise operations within the library) on platforms where sizeof(long) != > sizeof(ssize_t). How does the type change get things working -- I presume > regcomp() or regexec() was failing, but what was the underlying issue? > > Cheers! > Sean ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ BRL-CAD Developer mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/brlcad-devel
