- What is the data structure of a NULL? - 3 Updates
- Don't be fooled by cpp.sh - 3 Updates
- Two silly problems - 3 Updates
- [OT] Re: A question on RegOpenKeyExW - 2 Updates
- Probably UB but I am finding it hard to give a fuck (C++ swizzle) - 1 Update
Ned Latham <nedlatham@woden.valhalla.oz>: Dec 28 08:33AM -0600 Keith Thompson wrote: > If you're making a call from C++, you can just pass a null pointer > value such as nullptr or NULL. The compiler needs to know how > it's represented. You probably don't. But knowing it can be useful, I use (void*) to cast integers and unsigned integers for functions that require pointer parameters, and if (parm) to test them. |
Manfred <noname@add.invalid>: Dec 28 08:11PM +0100 On 12/27/2019 11:24 PM, T wrote: >> at all so stop posting constant lies and nonsense about it. > What size is it then? 32 or 64 or do you have to figure out > if you are running a 32 bit or 64 bit edition of Windows first? If you are running 32 bit windows, then it uses only 32-bit pointers. If you are running 64 bit windows, then it depends on the calling process (as there exist 2 versions of kernel32.dll, one for 64bit processes and one for 32bit processes). If you are still using Perl, then this means the Perl interpreter, but I guess the Perl doc should give some info on how to use pointers in native calls. |
Keith Thompson <Keith.S.Thompson+u@gmail.com>: Dec 28 01:22PM -0800 > But knowing it can be useful, I use (void*) to cast integers and > unsigned integers for functions that require pointer parameters, > and if (parm) to test them. Why? Can you share some examples? If a function takes a pointer parameter, you need to pass a pointer value to it. There are cases where it might make sense to cast an integer to void*, but they're rare. If you need to pass a null pointer, use nullptr or NULL. (In some low-level code, you might store pointer values in integers.) As for `if (parm)`, that's valid for any scalar type. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com [Note updated email address] Working, but not speaking, for Philips Healthcare void Void(void) { Void(); } /* The recursive call of the void */ |
"Öö Tiib" <ootiib@hot.ee>: Dec 28 08:39AM -0800 > in that case why bother with containers or C++ at all, lets just use a good > old fashioned C style automatic array! That'll work for all situations I have > no doubt. That does not follow. You asked question "how" and I answered. Why you constantly build strange straw-man arguments, claim these were made by others and then ludicrously moan and groan about it? Are you demented or is it just norm in your alien to me culture? What is your issue with std::array, boost::container::static_vector, std::pair, std::tuple, std::optional and so on? There was no point to use fixed size raw arrays before C++17 besides string literals. After C++17 it is likely that even string literals are best to use as std::string_view. Such are safer than raw array but generated code is as efficient. Such are of literal type if contained elements are of literal type and so can be used as constant expressions and arguments and return values of constexpr functions. Raw array is so dead in C++ but not because of your std:vector of pointers. |
boltar@nowhere.org: Dec 28 04:57PM On Sat, 28 Dec 2019 08:39:37 -0800 (PST) >> old fashioned C style automatic array! That'll work for all situations I have >> no doubt. >That does not follow. You asked question "how" and I answered. Why you I never asked how. My original question was "why". What exactly is the point of optional? I've yet to see a good argument for it. >others and then ludicrously moan and groan about it? Are you demented or >is it just norm in your alien to me culture? What? >What is your issue with std::array, boost::container::static_vector, >std::pair, std::tuple, std::optional and so on? Never used static_vector as I've managed to avoid the Boost bloatware so far but I have no problem with any of them except optional. >string literals. After C++17 it is likely that even string literals >are best to use as std::string_view. I'll stick to const char * until I see a good reason not to use it particularly as its stored in the program text, not the stack or heap. >values of constexpr functions. Raw array is so dead in C++ but not >because of your std:vector of pointers. Why is raw array dead? If I needed high performance, was just storing plain old data types and don't want the overhead of a container class no matter how minimal then I'd still use them. |
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Dec 28 09:01PM On Sat, 28 Dec 2019 12:05:30 +0000 (UTC) > >std::vector<std::optional<T>> is inferior to some other way of storing a > >collection of optional values? What other way are you thinking of? > I give up , its like talking to geese sometimes. Please make sure you keep to your word and stop posting any further on this subject. You have separately been told (Keith Thompson 26 Dec 2019 10:54:48 -0800) of the requirement in the standard that the contents of optionals are to be subsumed within the storage of the option, and so are not to give rise to any additional allocations on the heap, and the same applies to variants (discriminated unions), of which optionals are just a specialization: variants act in a similar way to C-style unions (but with type safety). In most uses they will be significantly more efficient than your earlier suggestion of using inheritance with virtual functions, and more convenient to write: visitors for std::visit are reasonably easy to write in C++17. Your condescending posts to those who have taken the trouble to explain this to you a number of times seems to show that have the emotional age of a teenager. |
Mr Flibble <flibble@i42.removethisbit.co.uk>: Dec 28 03:51PM On 28/12/2019 06:37, Alf P. Steinbach wrote: > only in a `using` declaration and for the two types that it builds here, > that is, three times; and the focus, what's communicated to a reader, is > on what the structure models. Alf, using deliberate exaggeration to try to invalidate a person's argument is disingenuous at best but I am sure you know this. void real_leigh() { std::size_t const width = 8; std::size_t const height = width; using row = std::array<int, width>; using board = std::array<row, height>; Board board{}; (void) board; // Whatever } Now please stop being a cunt. /Flibble -- "You won't burn in hell. But be nice anyway." – Ricky Gervais "I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
boltar@nowhere.org: Dec 28 04:30PM On Sat, 28 Dec 2019 15:51:29 +0000 > Board board{}; > (void) board; // Whatever >} Or since board is just storing ints you could both make it even simpler still using C99: size_t const width = 8; size_t const height = width; typedef int Board[width][height]; Board board; Just saying. |
Mr Flibble <flibble@i42.removethisbit.co.uk>: Dec 28 05:15PM > typedef int Board[width][height]; > Board board; > Just saying. Simpler isn't always better and one could argue that old C-style arrays can make certain code that *uses* them more complicated versus std::array usage. More or less the only use-case for C-style arrays in modern C++ are dynamic arrays for allocating uninitialized buffers; std::array is superior to C-style arrays for nearly all other use-cases due to the container-like interface it offers with NO associated overhead in offering it. Just saying. /Flibble -- "You won't burn in hell. But be nice anyway." – Ricky Gervais "I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
Bonita Montero <Bonita.Montero@gmail.com>: Dec 28 12:48PM +0100 > As the Win32 API is defined in C, ... There are a lot of IDispatch COM-APIs which can be easily used in a scripting-language. |
Manfred <noname@invalid.add>: Dec 28 06:14PM +0100 On 12/27/19 10:31 PM, T wrote: > You will find a definition for C++, not C, unless > this is a terrible misprint of M$'s part, which I > would not put past them. As Paavo replied, C++ in their docs is opposed to VB and C#, not C (being Visual C++, Visual Basic and C# probably their most popular development products). Technically, for the purpose of that API, C is a subset of C++, so it is not incorrect. A further confirmation that it is a C API is that windows headers declare its functions as 'extern "C"' when compiled in C++ code, so that C++ can transparently link to the API. One relevant difference (between a C and C++ API) for interfacing with other languages is that in order to allow for function overloading, C++ would require its exported symbol names to be mangled, while C does not. > REGSAM samDesired, > PHKEY phkResult > ); (A side note about the 'W' suffix (or 'A'): When applicable, Windows API functions come in two variants for ASCII and wide char (Unicode) strings; the companion function of the above is RegOpenKeyExA that handles ASCII strings. The documentation often refers to both collectively as RegOpenKeyEx, while the DLL exported function names are RegOpenKeyExA and RegOpenKeyExW) > about 5 times more helpful with me configuring the > proper data structures for Raku's NativeCall. Didn't > think you guys were that smart, did you! I am not an expert in Perl, but I would expect its documentation to give detailed information on how its runtime calls shared library functions. In addition, as Paavo said, some knowledge of C is also required. |
Mr Flibble <flibble@i42.removethisbit.co.uk>: Dec 28 03:53PM On 28/12/2019 08:30, Chris M. Thomasson wrote: > Looking forward to using C++ with swizzles, using your work, to render > something like the following experiment of mine: > https://youtu.be/TLd64a4gdZQ Probably best waiting until I get SIMD specializations working. /Flibble -- "You won't burn in hell. But be nice anyway." – Ricky Gervais "I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment