[PATCH v4 2/8] reg.exe: Add path_get_key() to remove boilerplate
Stefan Dösinger
stefandoesinger at gmail.com
Sun Oct 12 12:11:03 CDT 2014
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am 2014-10-12 18:38, schrieb Ken Thomases:
> It should work to make the long_name and short_name fields arrays
> instead of pointers, although that brings back the use of fixed
> lengths.
>
> The other approach is to define the strings like:
>
> static const WCHAR short_name_HKLM[] = {'H','K','L','M',0};
Those are the two of the three options I found. The third suggestion I
found was to cast the initializer to a const WCHAR [], like this (just
using char here for testing outside of wine):
static const struct
{
const char *foo;
int bar;
}
test[] =
{
{(const char []){'a', 'b', 'c', 0}, 5},
};
But that seems to be a C99 feature
(http://gcc.gnu.org/onlinedocs/gcc/Compound-Literals.html).
The other thing I noticed is that even my big fat C/C++ book is
completely clueless about this and (somewhat relatedly) initializes a
(non-const) char * with a string literal and later sprintf()s to it.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBAgAGBQJUOrYnAAoJEN0/YqbEcdMw0rYP/jYwnZgkNnIhAQVHxjCNhXyY
qBssmIY316J8w+NdPryAsI9PhE7F3VQAZVIL7nI/zuipfn7B0clM0lKqax+JFSYV
utQL33nJRaZO8ybwemLRcxGqwQYOUMxliTXU2ZBdEo7sRyoLBka41NVjA8E2afXk
9by8NhCKzQVUs4K/TNtvdFlT/0WUVNWcNtDHNbXsBmadGXpQlIu1TjHaMmKd2Irw
fPzWB11GFZ3JWaSdO3p8hNaqHuCb5tUVcewPm/mTf7robshVrzoA2jQXCU2ueAks
0mz938A/c+mMUH5ui/bqbIwTryHlHQsbeJHfrvrhgqPzbVnISJqMdC3dJtlndYlw
NO2eqTp04Q7gYJ0QSdMVkhF1vydMN422iuCiW1DH3sTqNqVHs+CAUb9AG0A1WTdr
bmM3VMIsN8zt7pLknukVGV5vez8dZbyyt9fJq9jtmnoQSq63cxIVGRgn/66FbUW8
uyRuZi3v53wsj6g1JuGFcvzh8Zc1SzSRPnJKWE/Kgj64r2pigwSRsS9El1v0n9PV
ibAAf/GpMpmSy+n1k8chJH996SDx0bEdWCAbIAwBxDBaaJ0uf3QUXmvH06OcaU1W
2iGCzpc0Kw8WgaKxluOrhLigXcyB/9cu8xk2iCSIOcqnjcJ5bewOVapeQHixkLvk
BEJDyBDsDFZncXyuYTCG
=tt1w
-----END PGP SIGNATURE-----
More information about the wine-devel
mailing list