- RAII design question - 2 Updates
- why can't you copy stringstream? - 1 Update
- "Death to C, ++" - 4 Updates
- optional va_args argument - 3 Updates
- Jesus Christ Rescuer Of All Who Will Be Rescued - 1 Update
- Difference between type(type) and type(*)(type) - 1 Update
Tim Rentsch <txr@alumni.caltech.edu>: Jul 24 10:17AM -0700 > a type is an object, thus: > int a = 42; // a is the name of an OBJECT of scalar TYPE 'int'. > foo o = 42; // o is the name of an OBJECT of class TYPE 'foo'. First let me clear up a confusion. My earlier comment was made in a limited context, where the only kind of data structuring being considered is classes. Of course there are other kinds of data structuring constructs available, eg, built-in ones like 'int' or 'double', or user-defined ones like enumerations. Let's use the word "structure" to encompass all of the different sorts of things that define the layout or memory structure of objects. So "structure" includes int, double, structs, unions, classes, pointers, arrays, etc. Returning to the main point under discussion, what I said is classes (or more generally, structures) are not /synonymous/ with types. A class (or other kind of structuring construct) can stand in for a type, but it is not the same as a type. A type can be more information than a structure, eg, int pi; // "plain" int const int ci; volatile int vi; The variables pi, ci, and vi all have the same structure, namely the same size, alignment, and representation that any 'int' object has. But they have different types, which means different rules for how they can be used. For example, it's okay to access the variable 'ci' as if it were just a plain int, as long as the access is a read access, not a write access. The variable 'vi' can be accessed as if it were a const volatile int, but not as if it were a const int. A type can be less information than a structure, as can be seen with array declarations: extern Animal *zoo[]; Here we know 'zoo' is an array (of pointers to Animal, which need not concern us further), but we don't know how big the array is. The type tells us /partial/ information about the structure, but not complete information. Some types don't deal with structure at all: extern void initialize_recovery_system( int threads ); Here of course we have a function type. There is no structure information associated with a function type. In C++, reference types seem to fall in a strange kind of limbo. Of course what we expect is that references will be implemented by holding on to some kind of pointer, but the C++ Standard insists that references are not objects (or maybe that they might no be objects? I'm not sure). If T is a reference type, then 'new T' doesn't work. But it's okay for a class or struct to have a member of a reference type, and you can bet your bottom dollar that how the class/struct is laid out will have some space allocated for that reference member. If anyone is interested to look into this further I recommend this paper, which AFAIK is the earliest explanation for how types and structures are different. (In Smalltalk the only kind of structuring construct is classes, but generalizing to other kinds of structuring mechanisms should be easy to see.) A type declaration and inference system for Smalltalk (1982) (http://citeseer.ist.psu.edu/showciting?cid=104638) Roughly speaking, a "type" is like an interface, and a "structure" is like an implementation. But don't take that literally, it is meant just as a way to aid understanding, not as an exact analogy. |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jul 24 11:09PM +0100 On 24/07/2017 18:17, Tim Rentsch wrote: > A class (or other kind of structuring construct) can > stand in for a type, but it is not the same as a type. Again you are wrong. In C++ a class is a type. /Flibble |
legalize+jeeves@mail.xmission.com (Richard): Jul 24 05:06PM [Please do not mail me a copy of your followup] Vir Campestris <vir.campestris@invalid.invalid> spake the secret code >So to me it makes perfect sense not to be able to copy cout - or any >other file based stream - but to be able to copy stringstream. Technically you're not copying the stringstream (no copy constructor is invoked and no assignment operator is invoked in the given code snippet). You're using an extra member function of stringstream (str) to obtain a copy of its internal buffer. -- "The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline> The Terminals Wiki <http://terminals-wiki.org> The Computer Graphics Museum <http://computergraphicsmuseum.org> Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com> |
Jens Stuckelberger <Jens_Stuckelberger@nowhere.net>: Jul 23 11:51PM On Tue, 18 Jul 2017 12:34:25 -0500, Lynn McGuire wrote: > "Death to C, ++" > https://techcrunch.com/2017/07/16/death-to-c/ The opening salvo for a language war. Cool. Let's enjoy watching people getting entangled in endless arguments that will solve absolutely nothing. Well, at least they will be good for some mental masturbation. |
GOTHIER Nathan <nathan.gothier@gmail.com>: Jul 24 02:04AM +0200 On Tue, 18 Jul 2017 12:34:25 -0500 > "42" schools begins with students learning how to rewrite standard C > library functions from scratch. But C is no longer suitable for this > world which C has built." WTF Xavier Niel has coded in his life? Who does really care about his fake school "42"? IIRC he started business in the "minitel rose" providing sexually advertised chat services. |
legalize+jeeves@mail.xmission.com (Richard): Jul 24 05:03PM [Please do not mail me a copy of your followup] Jens Stuckelberger <Jens_Stuckelberger@nowhere.net> spake the secret code > The opening salvo for a language war. Cool. Let's enjoy watching >people getting entangled in endless arguments that will solve absolutely >nothing. Well, at least they will be good for some mental masturbation. It's also good clickbait for developers. -- "The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline> The Terminals Wiki <http://terminals-wiki.org> The Computer Graphics Museum <http://computergraphicsmuseum.org> Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com> |
legalize+jeeves@mail.xmission.com (Richard): Jul 24 05:04PM [Please do not mail me a copy of your followup] GOTHIER Nathan <nathan.gothier@gmail.com> spake the secret code >WTF Xavier Niel has coded in his life? Who does really care about his fake >school "42"? IIRC he started business in the "minitel rose" providing sexually >advertised chat services. OK, this is making me laugh because I'm old enough to have experienced minitel when it was the sexting outlet of its day. LOL! -- "The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline> The Terminals Wiki <http://terminals-wiki.org> The Computer Graphics Museum <http://computergraphicsmuseum.org> Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com> |
David Brown <david.brown@hesbynett.no>: Jul 24 10:17AM +0200 On 23/07/17 22:30, jacobnavia wrote: > Gcc however devised a completely different and much more complicated > layout. You need two independent counters, so you can pass really a LOT > of stuff in registers instead of memory. For x86-64, gcc did not "devise" anything. On Windows, gcc uses the standard Win64 calling convention just like most other compilers (and I strongly recommend you do the same). On Linux, gcc uses the standard *nix x86-64 calling convention (gcc was one of several parties involved in making that calling convention - but AMD was in charge). Again, I would strongly recommend you stick to that convention for x86-64 on Linux. On 32-bit Windows, calling conventions were a mess - nothing was standardised, and every tool had a different favourite and half a dozen tool-specific qualifiers for accessing "foreign" functions. On 64-bit Windows there /is/ a standard calling convention, and you should stick to it. (It happens to be a bit inefficient for most function calls, compared to the method used on *nix, but it has the advantage here of being particularly easy for va_args functions.) |
Manfred <noname@invalid.add>: Jul 24 04:00PM +0200 On 7/24/2017 12:12 AM, Manfred wrote: > If this is not possible, the second alternative would probably be using > va_list*, and use address comparison as identity check, or you can use a > NULL va_list* when empty. By the way, for correct attribution, Ian Collins first mentioned in this thread va_list* and variadic templates: > Pass a va_list* instead? Or use a variadic template? Also, NULL would be nullptr in C++ |
Manfred <noname@invalid.add>: Jul 24 04:15PM +0200 On 7/23/2017 10:58 PM, jacobnavia wrote: > va_list with NULL? > That would be much clearer. > NULL as a default value should be OK with nicely designed classes isn't it? The problem is that as soon as you access the type va_list, with any operation, and even if you manage to do that, your code becomes non-portable. > out a common name for this object. "empty_va_list" is clear, but other > people could name it "no_args", and other va_list_default, or... you see? > NULL is already there for that purpose, just let's keep using that. If you really want to use NULL (i.e. nullptr in C++), then better use va_list* (as Ian Colling suggested earlier) In the general picture, though, this would only be a partial solution, because this would allow you to test for an explicit empty list (a call with nullptr as va_list*), but you would still have no information on count and type of arguments in the general case, because this is how va_list works. > start, read the next one, etc, within the va_args function. Each next > operation returns a copy of the value (args are passed by value, i.e. by > copying). What you are describing here is in fact what variadic templates are for. However, va_list is not such a thing. |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jul 24 05:14AM -0700 The Biblical account of man is a simple and correct one (jump to the end if you want to bypass the "tldr" details info): 1) God creates everything perfectly. 2) God gives everything to man. 3) God also gives man a choice by instructing him to note eat from the tree of the knowledge of good and evil. At this point, God has created man as He intended: a three-fold being, just as God is three-fold as God the Father, Son, Holy Ghost, so are we soul, body, spirit. For what is believed to be a very short period of time (only a few days, weeks, or months ... because one of God's commands to Adam and Eve were to go forth and multiply and bring forth children, and they would not have disobeyed God before sin was introduced), man lived in that true paradise of peace and love. Satan entered in and convinced Eve to eat from the tree of the knowledge of good and evil, and gave some to Adam and he also ate. The very moment this happened, sin entered in and they died spiritually. Their bodies continued on, but that last state of their being (spirit) was dead. This left them with only their natural flesh, their physical mind, to receive and process input, and it has no knowledge of spiritual things, no ability to discern spiritual things, but can only act based on the influence the spirit would give, for the Bible records the spirit "quickens" the flesh ... this is both the spirit of life in the flesh, but also the person's spirit which is a distinct trait and character of the individual, with its unique abilities to know, understand, and discern all spiritual things, just as our natural body can know, understand and discern all natural things. 4) Sin entered in. 5) Man died spiritually. 6) Satan was cast out of Heaven, and eventually down to the Earth. 7) Until a person comes to Jesus to have their sin taken away, they remain in this state of being dead spiritually, and under judgment and condemnation of God because they possess sin, which is charged to their own soul. When Jesus went to the cross, He had no sin. He was able to take on the entirety of our sin upon Himself so that when He died, our sin went with Him, rather than remaining on us. The price of on sin is death in Hell. The price of a million sins is the same death in Hell. Jesus was, therefore, able to take on all sin for all who would believe in Him, and die to it all once and for all. He then raised Himself back to life on the third day, and all who put their faith and trust in Him are raised to life with Him. Only God could do this. And He cared enough about us, His creation, to make a way back for all who would believe the truth, and ask for forgiveness for their sin from Jesus Christ. ----- ----- ----- ----- ----- To sum up the entire story in a nutshell: 1) God created everything. 2) Sin entered in, separating man from God. 3) God entered in, separating sin from man, restoring man back to God. What Jesus did is a rescue story, a love story, for us, His creation made in His very image and likeness. He did it to rescue us from the death our sin so rightly deserves. He now offers that free rescue to everyone who will receive it. That is the gospel message in a nutshell. Do you have sin? Jesus will forgive you today, right now, and rescue you from death. All you have to do is ask Him to forgive you. It is His free gift to you because He loves you, and wants to be with you in eternity more than He wants to judge you for sin. Thank you, Rick C. Hodgin |
"Öö Tiib" <ootiib@hot.ee>: Jul 23 04:58PM -0700 > > is the alleged benefit? > Perhaps C++ 2017 is to C++ 2011 as C++ 1998 is to C. I don't > know if the technical specifications would need to change. There are no such programming languages like "C++ 2011". Period. > I would simply like compiler vendors to do this for their > C++ 2011 compilers. What compiler vendor has releases such things named "C++ 2011 compiler"? I know none such vendors. I see no indications nor reasons why they will ever do that. > make it to the island, but they would be glad to get some > C++ 2017 features. Recall also my point that C++ 2011 was > both late and immature when it did finally arrive. OK, lets have thought experiment and imagine that for example Microsoft suddenly released a thing named "Microsoft C++ 2011 compiler" and "back-ported" exactly the features you want from current C++ and from C++1y drafts into it. Impossible but lets fantasize. There are guys who use use lets say "Visual Studio 2012". If they do not want to migrate to "Visual Studio 2015" then why they migrate to that "C++ 2011 compiler" abomination? |
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