Friday, October 31, 2014

Digest for comp.lang.c++@googlegroups.com - 5 updates in 2 topics

comp.lang.c++@googlegroups.com Google Groups
Unsure why you received this message? You previously subscribed to digests from this group, but we haven't been sending them for a while. We fixed that, but if you don't want to get these messages, send an email to comp.lang.c+++unsubscribe@googlegroups.com.
Christopher Pisz <nospam@notanaddress.com>: Oct 31 05:34PM -0500

On 10/31/2014 4:54 PM, Melzzzzz wrote:
> }
 
> Problem is that 32 bit int is not long enough, just use long long
> and all set...
 
or use C++ and drop the C style
 
#include <iostream>
 
int main()
{
long long i = 0x80000000;
std::cout << std::hex << i << std::endl;
 
return 0;
}
 
 
or if you will need the string later
 
 
#include <iostream>
#include <sstream>
 
int main()
{
long long i = 0x80000000;
std::ostringstream os;
 
os << std::hex << i;
std::cout << os.str() << std::endl;
 
return 0;
}
 
 
or at least #include <cstdlib> which has been for quite a long time now...
Geoff <geoff@invalid.invalid>: Oct 31 03:48PM -0700

On Fri, 31 Oct 2014 17:34:14 -0500, Christopher Pisz
 
>or at least #include <cstdlib> which has been for quite a long time now...
 
To be equivalent to the C code it needs to be
 
std::cout << "0x" << std::hex << i << std::endl;
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Oct 31 03:54PM -0700

On Friday, October 31, 2014 5:43:35 PM UTC-4, Marcel Mueller wrote:
> The goal is to read an unsigned number in all common formats (decimal,
> binary, octal, hex) from a string. The string does not necessarily end
> after the number. I did not find format specifier that does the job.
 
If you cannot get one to work and need a custom one, I would be willing
to write one for you using only C.
 
Best regards,
Rick C. Hodgin
Christopher Pisz <nospam@notanaddress.com>: Oct 31 06:07PM -0500

On 10/31/2014 5:48 PM, Geoff wrote:
 
> To be equivalent to the C code it needs to be
 
> std::cout << "0x" << std::hex << i << std::endl;
 
Looks like he might want to go the other way too. If that is the case
use istringstream and operator >>
 
Just Google c++ streams in general. Much prettier than scanf and printf.
I've found doing format specifiers inside of string literals is just
plain error prone.
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Oct 31 03:11PM -0700

On Friday, October 31, 2014 3:04:48 PM UTC-4, Richard Damon wrote:
> what 'code page' you system needs to be in. In effect, this limits what
> human languages are expressible in the file, including comments and
> strings.
 
I suppose so. It is my first offering. And I am doing this alone.
They tell authors to write what they know. I suppose it works for
developers as well.
 
> U+00A0 (how it will appear in the file depends on what encoding you
> choose (UTF-8 may be the best, which would give you 0xC2, 0xA0 as a
> multi-byte character).
 
Are you ready to come on board and help me code this UNICODE support?
 
Best regards,
Rick C. Hodgin
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.

Digest for comp.lang.c++@googlegroups.com - 25 updates in 6 topics

comp.lang.c++@googlegroups.com Google Groups
Unsure why you received this message? You previously subscribed to digests from this group, but we haven't been sending them for a while. We fixed that, but if you don't want to get these messages, send an email to comp.lang.c+++unsubscribe@googlegroups.com.
Marcel Mueller <news.5.maazl@spamgourmet.org>: Oct 31 10:43PM +0100

I recently had a problem with a GPU assembler. The program is mainly
C++11, but the parsing of expression components is done with sscanf.
This causes problems because sscanf cannot read the integer constant
"0x80000000". %i returns 0x7fffffff and %u cannot read hex numbers. I
could bet that this has been working with %i for many years.
 
I just tested with gcc 4.8.2 for OS/2 - works with %i.
But with gcc 4.8.2 Linux (Mint 17) the result is the bitwise not.
 
#include <stdio.h>
int main()
{ int i;
sscanf("0x80000000", "%i", &i);
printf("%x", i);
return 0;
}
 
The goal is to read an unsigned number in all common formats (decimal,
binary, octal, hex) from a string. The string does not necessarily end
after the number. I did not find format specifier that does the job.
 
 
Marcel
Melzzzzz <mel@zzzzz.com>: Oct 31 10:54PM +0100

On Fri, 31 Oct 2014 22:43:23 +0100
> necessarily end after the number. I did not find format specifier
> that does the job.
 
> Marcel
 
#include <stdio.h>
 
int main()
{ long long i;
sscanf("0x80000000","%lli",&i);
printf("%llx\n", i);
return 0;
}
 
Problem is that 32 bit int is not long enough, just use long long
and all set...
 
--
Manjaro all the way!
http://manjaro.org/
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Oct 31 09:48AM -0700

On Friday, October 31, 2014 9:10:51 AM UTC-4, David Brown wrote:
> Re-consider it - you don't want the same expression to mean different
> things when it is written alone, or part of another statement.
 
David, what does *tnX++; mean when used by itself?
 
Best regards,
Rick C. Hodgin
Nobody <nobody@nowhere.invalid>: Oct 31 07:26PM

On Fri, 31 Oct 2014 09:48:57 -0700, Rick C. Hodgin wrote:
 
>> Re-consider it - you don't want the same expression to mean different
>> things when it is written alone, or part of another statement.
 
> David, what does *tnX++; mean when used by itself?
 
It means the same as "*(tnX++);".
 
In most cases, that means the same as just "tnX++;", because you're not
actually using the result of the dereference and a dereference doesn't
normally have side effects.
 
But if tnX is "volatile T*", the two aren't the same and the original
statement may actually be useful (e.g. forcing data to be copied from
main memory to cache or from virtual memory to main memory, or triggering
an action which occurs when a memory-mapped hardware register is read from).
 
Yet, such cases may well occur in real-world code (and not (just) because
the programmer meant to write something else). They may result from macro
expansion; e.g. consider the macro
 
#define getch(fp) (*(fp)->ptr++)
 
typically used as "c = getch(fp);" but quite reasonably used as just
"getch(fp);" if you want to skip a character.
 
Such issues (warnings about valid but "odd" constructs) occur frequently
in machine-generated code. Having the compiler attempt to second-guess the
intent in such cases would make it much harder to generate reliable code.
And it would probably also make it harder for humans, who won't always
remember (or even know about) all of the "special case" rules.
 
The problem with "DWIM" ("Do What I Mean") is: who is the "I"? The
person that developed the software, or the person trying to use it?
Richard Damon <Richard@Damon-Family.org>: Oct 31 12:28PM -0700

On 10/31/14, 9:48 AM, Rick C. Hodgin wrote:
 
> David, what does *tnX++; mean when used by itself?
 
> Best regards,
> Rick C. Hodgin
 
Increment tnX, and then provide the value that the previous value of tnX
pointed to (which is then ignored if the phrase is written alone).
 
Something like (where temp has the same type as tnX):
 
( (temp = tnX) , (tnx = tnx+1) , (*tnX))
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Oct 31 02:18PM -0700

On Friday, October 31, 2014 3:25:08 PM UTC-4, Nobody wrote:
> remember (or even know about) all of the "special case" rules.
 
> The problem with "DWIM" ("Do What I Mean") is: who is the "I"? The
> person that developed the software, or the person trying to use it?
 
I appreciate your input. I will consider it.
 
FWIW, I hold that volatile constraints place things in a completely
separate category. And in this case, outside of their use, neither
GCC or MSVC generated assembly opcodes for the dereference in non-
optimization mode (where one would expect it to be generated if any
were to be generated).
 
To me, that non-generation is telling.
 
Best regards,
Rick C. Hodgin
 
PS - Sylvia told me you called today, but then hung up? What's up with
that? :-) (+2 if you get that ancient reference)
legalize+jeeves@mail.xmission.com (Richard): Oct 31 04:44PM

[Please do not mail me a copy of your followup]
 
Wouter van Ooijen <wouter@voti.nl> spake the secret code
 
>Sheet 8 states "new should only appear in constructors". What about an
>assignment that must do a deep copy?
 
I had you on mute because you were feeding trolls on the religious
thread.
 
You shouldn't ever need naked new or naked delete anywhere except
c'tors/d'tors for resource handling classes.
 
This implies that you don't have any raw pointers that indicate
ownership of resources, except in such resource handling classes.
 
If you follow that advice, then deep copy is simply member-wise
assignment and that is by definition the compiler generated copy
c'tor.
--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Computer Graphics Museum <http://computergraphicsmuseum.org>
The Terminals Wiki <http://terminals.classiccmp.org>
Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
legalize+jeeves@mail.xmission.com (Richard): Oct 31 04:45PM

[Please do not mail me a copy of your followup]
 
Wouter van Ooijen <wouter@voti.nl> spake the secret code
 
>> thus invoking the assignment of objects, not their pointers.
 
>If the pointed-to object is an array of let's say chars that can have a
>different length this won't work very well.
 
Use std::vector<char> and it's fine.
 
You shouldn't have naked pointers to indicate ownership, unless you
are writing a resource managing class like std::vector<>,
std::shared_ptr<>, etc.
--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Computer Graphics Museum <http://computergraphicsmuseum.org>
The Terminals Wiki <http://terminals.classiccmp.org>
Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
legalize+jeeves@mail.xmission.com (Richard): Oct 31 04:48PM

[Please do not mail me a copy of your followup]
 
Wouter van Ooijen <wouter@voti.nl> spake the secret code
 
>> Once you know the rules, you know when they don't apply.
 
>Not completely true. If you know how it works you know what to do: you
>don't need a rule.
 
It's advice, not a rule. Avoiding this advice will cause yourself
needless pain.
 
Seriously, this advice has been in books by Stroustrup and others, as
well as general advice in newsgroups, for at least 20 years.
 
Whenever I see people whinging about how difficult C++ is and how it's
a source of bugs, it's because THEY DIDN'T FOLLOW THE ADVICE.
 
You can take the advice and make it a rule and you'd be much better
off, but plain and simple Stroustrup doesn't set himself up as a
dictator and neither do I. We offer advice based on the experience of
seeing people over and over again ignore the advice and code themself
up a bucket of snakes. If you want to shoot yourself in the foot, be
my guest.
--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Computer Graphics Museum <http://computergraphicsmuseum.org>
The Terminals Wiki <http://terminals.classiccmp.org>
Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
woodbrian77@gmail.com: Oct 31 12:29PM -0700

On Friday, October 31, 2014 11:44:37 AM UTC-5, Richard wrote:
> >assignment that must do a deep copy?
 
> You shouldn't ever need naked new or naked delete anywhere except
> c'tors/d'tors for resource handling classes.
 
I get the impression that some here don't like it in even
these cases. I'm fine with it there.
 
I've compared these two lines:
 
auto req=::std::unique_ptr<cmw_request>(::new cmw_request(localbuf));
 
auto req=::std::make_unique<cmw_request>(localbuf);
 
 
On clang 3.3, the make_unique version increases the size
of a text segment by 112 bytes. I think I've tried it
on some newer compilers and found similar results.
 
Brian
Ebenezer Enterprises - Create in me a clean heart, O G-d,
And renew a steadfast spirit within me. Psalms 51:10
 
http://webEbenezer.net
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Oct 31 07:15AM -0700

On Friday, October 31, 2014 9:44:12 AM UTC-4, David Brown wrote:
> He may be talking about many people, including me. I've been declared
> to be someone Rick will not answer, though I actually am not sure why.
 
I hereby reset my "someone Rick will not answer" list to be completely
empty. Everything starts anew! :-)
 
The people who have gone on that list, and others will go on it again I
have no doubts, have been demeaning and hurtful, purposefully negative
rather than honestly helpful, and as a pattern lasting for more than a
few posts.
 
There is a spirit which operates in this world. We cannot see him with
our eyes, just as we cannot see God, but he is there, just as He is there.
 
What we can see is the action in people because of the spiritual presence.
The devil and his demon imps stir up hate, violence, demeaning speech, in
people. He tempts them to lust, commit acts of sin, satiate self at the
expense of others, or of righteousness.
 
I cease speaking with people who are moved by that spirit because that
spirit is there for only one reason: to steal, kill, destroy, whatever it
can (ideas, hope, inspiration, everything). Such a spirit cannot be
reasoned with, talked to, it will only and always turn anything said into
a debate or argument, trying to twist things around into man's reasoning
rather than a solid faith upon/in God.
 
There is a real spiritual battle taking place in this world. It's why
there is so much hate and harm. And Jesus really is the ONLY way out
of that hate because He is the only one who has overcome all of it.
Because of His victory, those who put their faith in Him also stand in
victory because He gives to all who come to Him, without any exceptions,
provided you come to Him as He is, seeking from your inmost heart the
Truth. It is the only way He is found ... when you seek Him with all
your heart.
 
http://biblehub.com/jeremiah/29-13.htm
"13 And ye shall seek me, and find me, when ye shall search for me with
all your heart."
 
People are unaware they are letting Satan and his demon imps work
through them because of the fallen sin nature and man's inability to
know the truth by himself. It is a supernatural act of God that any
man can be restored. But God looks into a person's true self and
knows if a man will hear the Truth, and if so He moves in that person's
life to change the course over time, so that they will be saved.
 
It is a true daily battle for every Christian. And also for every non-
Christian, but the non-Christian does not recognize there is a battle
taking place and is generally left alone because they're already where
Satan wants them (on the path to Hell). But for those who stand up and
speak unto God, and who speak of Jesus Christ and each of our need for
forgiveness by Him through His atoning sacrifice on the cross, that's
where the enemy's fire goes.
 
There's a great sermon about this by Steve Lawson. I would advise
everyone watch it and listen to what he's teaching. He's teaching
that there is an invisible war taking place all around us, that
things are happening in the spiritual realm which translate into
physical action down here upon this Earth in people, in even nations
rising up against nations. The powers that are at work are massive.
In Lawson's teaching he speaks about Job from the Bible who had
everything he possessed taken from him when God gave Satan permission
to lay his hand upon everything he had. And Satan did it because he
hates God. He hates you and me. All he is is hate.
 
Do you know there are only three times in scripture we actually hear
the voice of Satan recorded? Look at the overall theme here (para-
phrased):
 
(1) Garden of Eden, to Adam and Eve. "God's withholding His
blessing by keeping you from the fruit of the tree of the
knowledge of good and evil."
 
(2) In Heaven to God, regarding Job. "God, you're being too
good to Job. If you took away his stuff, he'll curse you
to your face."
 
(3) In the wilderness to Jesus during Jesus' 40-day fast.
"All of this has been given to me, and I can give it to
whomever I choose. If you will bow down and worship me,
I'll be better to you than God."
 
He tells Adam and Eve "God's being too good to you," then God, "You're
being too good to them," and then Jesus, "I'll be better to you than
God."
 
He is only and always setting everyone against everyone else because
he wants to be God and he hates the fact that he cannot be God because
there is only one God who is God. He is God the Father, God the Son,
and God the Holy Spirit ... the Almighty.
 
A description of Satan's goals:
http://biblehub.com/isaiah/14-13.htm
http://biblehub.com/isaiah/14-14.htm
http://biblehub.com/isaiah/14-15.htm
 
"13 For thou hast said in thine heart, I will ascend into heaven, I
will exalt my throne above the stars of God: I will sit also upon the
mount of the congregation, in the sides of the north."
 
"14 I will ascend above the heights of the clouds; I will be like the
most High."
 
"15 Yet thou shalt be brought down to hell, to the sides of the pit."
 
That is the enemy we face. One who desires to rule the Heavens and
be God. And there is not one of us upon this Earth who can stand
against him, but only the Lord Jesus Christ, rightly called "Lord"
because of what He's done, and because of who He is.
 
Make no mistake about it ... we are all in this war. Some will wind
up on the losing side because they would not humble themselves.
Others will forgo self and submit themselves unto the Lord humbly,
and ask forgiveness, and be forgiveness, and shine like the stars
in Heaven forever.
 
Each man has a choice to make. And the enemy is working continually
in your life to stop you from making the right one. But all you have
to do is turn to Him in your heart, in the quiet recesses of your mind,
and ask Him to save you. Ask Him to come to you and lead you out of
captivity and He will do so. He hears your thoughts. He knows your
heart. He knows your truest intentions and aspirations. When you
humble yourself and come to Him, He will ALREADY have been working on
your life to save you, because He knows your thoughts afar off.
 
Come to Him, and ask forgiveness, and ask Him to save you, and you
too will be saved this very day. You'll be forever glad you did.
 
Best regards,
Rick C. Hodgin
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Oct 31 07:20AM -0700

The Invisible War, by Steve Lawson:
http://www.libsf.org/video/steve_lawson__the_invisible_war.mp4
 
You can also find it on YouTube by googling:
"YouTube Steve Lawson The Invisible War"
 
Here is the full video on YouTube:
https://www.youtube.com/watch?v=UDVWvOQvlK8
 
Best regards,
Rick C. Hodgin
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Oct 31 02:59PM

On 31/10/2014 13:40, Rick C. Hodgin wrote:
> use only underscores or some type of case like camelCase.
> However, if you want to use spaces, then it's now available (or
> soon will be, James 4:15).
 
James was a cunt but not as much of a cunt as Jesus; or to put it
another way: stop fucking preaching in this technical newsgroup.
 
 
> (2) No one is forced to use RDC. People will use it because they
> want to, and for no other reason. There are lots of other compilers
> with all of their favorite stand-bys.
 
I suspect no one will use this "RDC" thing except you if this spaces
debacle is indicative of how you approach things
 
 
> (3) A person could easily parse and type in the ASCII-255 character. In
> Windows it's Alt+numpad 255. I'm sure it's possible in Linux too.
 
Yeah, twice as many keystrokes as underscore and four times as many as
multiple underscores.
 
> the display to in some way mark off the single variable with the
> nbsp character ... then perhaps you should switch to an open source
> editor? Just a thought...
 
Yeah switch to an open source editor just so they can type spaces that
aren't spaces in things that shouldn't have spaces.
 
/Flibble
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Oct 31 03:03PM

On 31/10/2014 14:15, Rick C. Hodgin wrote:
> your life to save you, because He knows your thoughts afar off.
 
> Come to Him, and ask forgiveness, and ask Him to save you, and you
> too will be saved this very day. You'll be forever glad you did.
 
 
Mate, just fuck off.
 
/Flibble
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Oct 31 08:15AM -0700

Mr Flibble wrote:
> [snip]
 
Mr Flibble, I love you. Jesus loves you more.
 
As He brings you to my remembrance, I will keep you in my prayers.
Take care my friend. I will be here if you would like to contact
me. And remember, there are none so far away from the Lord that
His tremendous Love cannot reach, should they have even the smallest
inkling of desire from within to seek Him. He is able to save to
the uttermost.
 
May He guide you from within, Mr Flibble, forever to His Kingdom
in the glories of Heaven.
 
Best regards,
Rick C. Hodgin
Robert Wessel <robertwessel2@yahoo.com>: Oct 31 10:35AM -0500

On Fri, 31 Oct 2014 06:40:25 -0700 (PDT), "Rick C. Hodgin"
> use only underscores or some type of case like camelCase.
> However, if you want to use spaces, then it's now available (or
> soon will be, James 4:15).
 
 
While *I* might avoid the embedded pseudo-spaces, but if I have to
look at source code that someone else has written, all my tools are
trashed.
 
 
>(2) No one is forced to use RDC. People will use it because they
> want to, and for no other reason. There are lots of other compilers
> with all of their favorite stand-bys.
 
 
Whatever your goals are, setting up extra roadblocks to the use of
your language seems like a bad idea. Especially when they accomplish
so little. What, again, is so horrible about underscores?
 
The last is a rhetorical question, I've seen you prior
justification(s), which I find wholly unsatisfying, so unless you have
a new one, let's leave it at you really don't like underscores for
some unfathomable (to me) reason.
 
In any event programming languages are not the same as human
languages, and meet different goals. Trying to make a language more
like English leads you down the road of Cobol. Which, despite a
rather convoluted and complex syntax, and a huge effort to actually be
English-like, pretty much failed utterly at that goal.
 
 
>(3) A person could easily parse and type in the ASCII-255 character. In
> Windows it's Alt+numpad 255. I'm sure it's possible in Linux too.
 
 
When you do that, by default, you end up with an 0xa0 in your file. Or
it may depend on which version of notepad you're running. It also
doesn't display well.
 
I expect that in a lot of cases you're going to end up with either a
0xc2 0xa0 or a 0xc3 0xaf in your file, which will probably break
*your* tools.
 
 
> the display to in some way mark off the single variable with the
> nbsp character ... then perhaps you should switch to an open source
> editor? Just a thought...
 
 
It's not just editors, there are a lot of tools which won't deal with
this well, especially once you add the PC/OEM code page vs. Unicode
distinction to the mix.
David Brown <david.brown@hesbynett.no>: Oct 31 05:05PM +0100

On 31/10/14 15:15, Rick C. Hodgin wrote:
> have no doubts, have been demeaning and hurtful, purposefully negative
> rather than honestly helpful, and as a pattern lasting for more than a
> few posts.
 
I call a spade a spade. If I see you have an idea I think is good, I
will say so. If you have an idea that I think can be improved, I will
give suggestions. And if I see an idea that I think is utterly stupid,
I will call it utterly stupid. If you find that "demeaning", then I
suggest you think through some of your ideas a little better - and
listen to the responses and advice given. My aim in the technical
comments I post is to be helpful - if I have been cruel, it is to be kind.
 
(In case it is still not entirely clear, I think many of your ideas are
good or at least interesting, and while they may not make sense for C
they would be fine for your own language. But a few of them, such as
your weird spaces idea, are /really/ bad, and it would be disrespectful
to you if people let them pass without trying to persuade you to drop them.)
 
Note also that I am condemning the "sin", not the "sinner".
 
 
Regarding your religious posts and comments, it's been made abundantly
clear that they are not welcome here. Nobody - Christians, atheists,
agnostics, pastafarians, or whatever - appreciates them. Nobody thinks
they are of any benefit or help. Even the other Christians in this
group understand that the way you write is going to chase people away
rather than persuade people to consider Christianity. In your own
terms, /you/ are doing Satan's work.
 
Unlike many here, I am quite happy with the occasional religious thread,
just as I am quite happy with the occasional political or other
off-topic thread. But it should be kept in a separate thread. There is
a time and a place for such discussions - I am sure you know the
Biblical quotation about there being a time for all things. And when
there /is/ a religious discussion, you will get on far better by keeping
to the point and the issues at hand, rather than continuously re-cycling
the same theories about a "war". If you like, try /fighting/ the "war"
by being a positive influence in your posts, rather than just moaning
about it.
 
Again, if you find this hurtful then I am sorry for you - but I write
this to be helpful to /you/.
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Oct 31 09:33AM -0700

On Friday, October 31, 2014 12:05:30 PM UTC-4, David Brown wrote:
> Regarding your religious posts and comments, it's been made abundantly
> clear that they are not welcome here.
 
The Lord will not ask me on the final day if I was popular, or if I
made converts, but only if I obeyed Him. Have you ever read Matthew
28:18+? And John 13:34 (or printf("John \015:\042\n"); // If you prefer)?
There, I used octal. :-)
 
http://biblehub.com/matthew/28-18.htm // All authority, so I tell you:
http://biblehub.com/matthew/28-19.htm // Go, teach, even baptize
http://biblehub.com/matthew/28-20.htm // Teach them to obey me
http://biblehub.com/matthew/28-21.htm // I am with you always
 
http://biblehub.com/john/13-34.htm // Love one another
// "as I have loved you"
 
Best regards,
Rick C. Hodgin
Richard Damon <Richard@Damon-Family.org>: Oct 31 12:04PM -0700

On 10/29/14, 11:31 AM, Rick C. Hodgin wrote:
> code 255. It looks just like a space even. :-)
 
> Best regards,
> Rick C. Hodgin
 
One comment about use '255' as the value of your 'space' character, is
that seems to be implying that your language has, in effect, defined
what 'code page' you system needs to be in. In effect, this limits what
human languages are expressible in the file, including comments and
strings.
 
It would seem much better to adopt the Unicode encoding for your
character set. You might still allow some way to define that a given
file is written in a extended ASCII 8 bit character set (and defining
WHICH extended 8 bit character set it is in).
 
If you do this, then the value of the non-break-space character is
U+00A0 (how it will appear in the file depends on what encoding you
choose (UTF-8 may be the best, which would give you 0xC2, 0xA0 as a
multi-byte character).
drew@furrfu.invalid (Drew Lawson): Oct 31 07:11PM

In article <228d9393-add0-4911-805c-99db8671e9df@googlegroups.com>
 
>28:18+? And John 13:34 (or printf("John \015:\042\n"); // If you prefer)?
 
That prints:
:"hn
 
(And this from someone claiming to know when character substitutions make sense.)
 
--
Drew Lawson | Pass the tea and sympathy
| for he good old days are dead
| Let's raise a toast to those
| who best survived the life they led
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Oct 31 12:14PM -0700

On Friday, October 31, 2014 3:11:14 PM UTC-4, Drew Lawson wrote:
> :"hn
 
> (And this from someone claiming to know when character substitutions
> make sense.)
 
:-)
 
Best regards
Rick C. Hodgin
porparek@gmail.com: Oct 31 10:03AM -0700

Hi,
 
I found that returning from my_fun is costless. None of the constructors or assignment operator of Human is called.
I expect the non-default constructor of Human to be called as the result of "return value optimization".
Why is that ?
 
I compiled it as follows (no c++11):
g++ -O0 my_prog.cpp
 
I use gcc 4.9.1 and boost 1.56.0.
 
#include <iostream>
#include <boost/tuple/tuple.hpp>
 
using namespace boost;
using namespace std;
 
class Human
{
public:
string m_name;
 
Human(void)
{
cout << "Human default constructor" << endl;
}

Human(string name) : m_name(name)
{
cout << "Human non-default constructor" << endl;
}

Human(const Human &b) : m_name(b.m_name)
{
cout << "Human copy constructor" << endl;
}
 
Human &operator=(const Human &right)
{
cout << "Human operator=" << endl;
m_name = right.m_name;
return *this;
}
};
 
boost::tuple<Human, string> my_fun(void)
{
Human h("xx"); // constructor
string pet("zz");
return boost::make_tuple(h, pet); // make_tuple calls copy constructor
}
 
int main(void)
{
boost::tuple<Human, string> myTuple = my_fun (); // nothing is called (excluding the constructor called inside my_fun and copy constructor called by make_tuple). Does this mean that return operation is costless ? How can it be ?
return 0;
}
 
thanks for clarification
Victor Bazarov <v.bazarov@comcast.invalid>: Oct 31 01:35PM -0400

> I found that returning from my_fun is costless. None of the constructors or assignment operator of Human is called.
> I expect the non-default constructor of Human to be called as the result of "return value optimization".
> Why is that ?
 
Why is what? Why is it that you expect the non-default c-tor of Human
to be called? I don't know. Why do you?
 
RVO allows the compiler to eliminate copying from the value in the
'return' expression in some function whose body the compiler can see,
when that value is used to initialize another object of the same type.
 
blah func_returning_a_blah()
{
...
return some_blah;
}
...
blah b = func_returning_a_blah(); // no copying due to RVO
 
If the compiler can see the function, it will inline the code in such a
way so it initialized the 'some_blah' directly into 'b'.
 
 
> int main(void)
> {
> boost::tuple<Human, string> myTuple = my_fun (); // nothing is called (excluding the constructor called inside my_fun and copy constructor called by make_tuple). Does this mean that return operation is costless ? How can it be ?
 
Costless, yes. What's the big deal?
 
As an experiment, move 'my_fun' function definition to a separate
translation unit, and you *might* see a copy made, depending on how
clever your compiler is. However, often the compiler can create a
hidden "argument" for a value-returning function for the return value
(since it is needed by the caller anyway), and in the case of the
initialization, the address of the object being initialized is going to
be used as that hidden "argument", so even after moving the function so
it can't be inlined any longer, you are still going to see no copy made.
 
> return 0;
> }
 
> thanks for clarification
 
V
--
I do not respond to top-posted replies, please don't ask
Paavo Helde <myfirstname@osa.pri.ee>: Oct 31 01:46PM -0500

porparek@gmail.com wrote in
 
> "return value optimization"
> How can it be ?
 
I have understood that typically the caller reserves some space on the
stack for the result variable and passes its address to the called
function. When the function comes around to construct the return value or a
named variable which will be returned later, it constructs it directly at
the specified address. This requires some cooperation between the caller
and the called function. For details see
 
http://en.wikipedia.org/wiki/Return_value_optimization
legalize+jeeves@mail.xmission.com (Richard): Oct 31 04:38PM

[Please do not mail me a copy of your followup]
 
On November 12th, the Utah C++ Programmers group will have their next
meetup. We'll discuss how to make efficient recursive descent parsers
using the Boost.Spirit library. We will also be raffling off a Visual
Sutdio Ultimate with MSDN Universal subscription. This is a $13,300
value courtesy of Microsoft.
 
Details here:
<http://www.meetup.com/Utah-Cpp-Programmers/events/210984212/>
--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Computer Graphics Museum <http://computergraphicsmuseum.org>
The Terminals Wiki <http://terminals.classiccmp.org>
Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
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.

Fw: Fwd: 這是錯覺

 


On Friday, October 31, 2014 9:34 AM, Tina Soong <tsoongtotherim@aol.com> wrote:




Sent from my iPad

Begin forwarded message:

From: Lu Pao-ching <pda6666@gmail.com>
Date: October 31, 2014 at 4:07:59 AM CDT
To: undisclosed-recipients:;
Subject: Fwd: 這是錯覺

 


No.1【深海恐懼症測試】



看到上圖,出現手抖,心理壓抑,胸口悶,喘不上氣等現象,說明你有海水恐懼症的前兆,大家來試一下!

No.2【強力催眠】



看到此圖,可緩解你的睡眠壓力。

No.3【超強力催眠】



無限循環,超強力催如夢,加強版催眠。

No.4【眨眼變形圖】



看這個圖要不斷的快速眨眼。

No.5【神奇的圖片】



盯著中心看20秒後圖就消失了。

No.6【順逆旋轉】



據說慣用左腦思考的人看到這張圖一直是順時針旋轉,
慣用右腦的人看到一直是逆時針旋轉,
智商突破天際的人,會看到順逆旋轉,你呢?


No.7【測試眼力】



這幅圖,雖然看上去有點可怕,
不過回過神來想想,還真是有創意。
你能看到幾種動物?
據說有人看到30種哦。
答案:
0-10,超級近視。
11-20,正常視力。
21-30,你就是放大鏡。
30以上,膜拜大神。


No.8【槍口指向你】

無論你從哪個角度看,槍口都指著你



No.9【列車駛向】



精神力強的人可以改變列車的行駛方向。

No.10【不信你不暈】



不服,你試試?



Digest for comp.lang.c++@googlegroups.com - 25 updates in 3 topics

comp.lang.c++@googlegroups.com Google Groups
Unsure why you received this message? You previously subscribed to digests from this group, but we haven't been sending them for a while. We fixed that, but if you don't want to get these messages, send an email to comp.lang.c+++unsubscribe@googlegroups.com.
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Oct 30 09:07PM -0700

I was able to get the non-breaking-space ability added to my parser and
IDE tonight. It now allows me to have non-breaking-spaces added to every
variable name, function name, table field, etc., in an XBASE language.
The same will be introduced into RDC.
 
It uses Shift+spacebar to insert the nbsp character, which internally
is stored as ASCII-255 in the text file.
 
http://snag.gy/QjtXc.jpg
 
I will probably change the formatting somewhat. Right now I'm using a
1 point size smaller font size so the space looks normal with the
smaller text. I'll probably put it back up to normal size and go with
my original half-space idea. I'm also using only a fixed dark blue
background with a 15% opacity over white. I think it's still too "in
your face" and will work on the presentation.
 
Best regards,
Rick C. Hodgin
Robert Wessel <robertwessel2@yahoo.com>: Oct 31 12:00AM -0500

On Thu, 30 Oct 2014 21:07:08 -0700 (PDT), "Rick C. Hodgin"
>my original half-space idea. I'm also using only a fixed dark blue
>background with a 15% opacity over white. I think it's still too "in
>your face" and will work on the presentation.
 
 
And in the process you've broken every tool, other than yours, which
someone might want to use to look at or manipulate a source file.
Heck, you can't even display a page of source code on a web site
anymore without heroics.
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Oct 31 05:00AM -0700

> Heck, you can't even display a page of source
> code on a web site anymore without heroics.
 
"Heroics." Hmmm. Interesting.
 
"Come and visit LibSF.org, where developers
code more like people, and our web server's
are heroic."
 
Best regards,
Rick C. Hodgin
Daniel <danielaparker@gmail.com>: Oct 31 05:53AM -0700

On Friday, October 31, 2014 8:01:04 AM UTC-4, Rick C. Hodgin wrote:
 
> "Come and visit LibSF.org,
 
"There's a man I've met on an online forum. He is negative and hurtful in his
comments, ... he's being led by false spirits seeking to do harm ... I pray
that this man will humble himself before the Living God, believe, repent, and
be saved." - Rick C. Hodgin
 
I think he's talking about you, Mr Flibble.
 
Daniel
Daniel <danielaparker@gmail.com>: Oct 31 05:55AM -0700

On Friday, October 31, 2014 8:01:04 AM UTC-4, Rick C. Hodgin wrote:
 
> "Come and visit LibSF.org, where developers
> code more like people, and our web server's
> are heroic."
 
Pride, Mr Hodgin, pride goeth before destruction, and an haughty spirit before a fall.
scott@slp53.sl.home (Scott Lurndal): Oct 31 01:31PM


>> I'd never willingly develop code in an editor that hides the
>> difference between two distinct characters.
 
>I would not use the default font's character for this, but instead I
 
A language where one cannot use their favorite editor is pretty
close to useless.
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Oct 31 06:33AM -0700

On Friday, October 31, 2014 8:55:55 AM UTC-4, Daniel wrote:
> > are heroic."
 
> Pride, Mr Hodgin, pride goeth before destruction, and an
> haughty spirit before a fall.
 
Agreed. Proverbs. One of the wisdom books.
http://biblehub.com/proverbs/16-18.htm
 
(1) I was being silly, attempting humor.
(2) God does not want us to be without pride, nor without a view of
ourselves. He just does not want it artificially inflated, as
with yeast, but only insomuch as is correct. A person can be
proud of their accomplishments, but they must recognize that the
reason they had any such accomplishment in the first place was
because God gave them the abilities and opportunities to do so.
 
Have you considered this verse?
http://biblehub.com/romans/12-3.htm
 
"For I say, through the grace given unto me, to every man that is
among you, not to think of himself more highly than he ought to
think; but to think soberly, according as God hath dealt to every
man the measure of faith."
 
The man who focuses his life upon the Lord, for example, can take pride
in his work because it is a right work. The man who strives with great
effort to live a holy life can take pride in the fact that he is living
a holy life. But he must not become conceited or prideful in himself,
but in all ways acknowledge first the Lord.
 
What is wrong is the, "Hey, I'm all that and a bag of chips" attitude
about oneself. Jesus taught us to first remove the beam from our own
eye, and then we will see clearly to remove the speck from our brother's
eye, meaning it is okay to reach out to guide another, provided you are
first taking care of yourself.
 
Ours (Christians) is a communal effort. We are not practicing our
faith in isolation, but as part of a community, His community. We
remind each other continually of the things we should be doing, because
the enemy is real and is actively prowling around seeking whom he may
devour with temptation and culmination in sin.
 
I am proud of the work I've done with regards to LibSF. It has been
an ongoing, continuous battle against all other people, including my
own family. Everyone has told me to set it aside and conform to the
more conventional ways of the world. I have persisted through it all,
and when I look at myself in the mirror, apart from the standard degree
of self-examination where I always look at myself and think, "You
could've done more, Rick," I am pride, and even humbled at the fact
that I have been able to continue because there have been times it has
been so very very hard to proceed. Times I've even laid in bed crying
because of what I was having to endure as I moved forward for my Lord.
But, I persisted. And I have been very proud of that, because it is a
right thing to do that is not centered upon myself, but upon Him, and
devotion unto Him.
 
Best regards,
Rick C. Hodgin
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Oct 31 06:40AM -0700

On Friday, October 31, 2014 9:31:49 AM UTC-4, Scott Lurndal wrote:
> A language where one cannot use their favorite editor is pretty
> close to useless.
 
(1) No one is forced to use spaces. Use your favorite editor and
use only underscores or some type of case like camelCase.
However, if you want to use spaces, then it's now available (or
soon will be, James 4:15).
 
(2) No one is forced to use RDC. People will use it because they
want to, and for no other reason. There are lots of other compilers
with all of their favorite stand-bys.
 
(3) A person could easily parse and type in the ASCII-255 character. In
Windows it's Alt+numpad 255. I'm sure it's possible in Linux too.
 
(4) If your editor is proprietary and you cannot get the source code
to go in and make an easy way to accept Shift+Spacebar, and alter
the display to in some way mark off the single variable with the
nbsp character ... then perhaps you should switch to an open source
editor? Just a thought...
 
(5) Hi. :-)
 
Best regards,
Rick C. Hodgin
David Brown <david.brown@hesbynett.no>: Oct 31 02:44PM +0100

On 31/10/14 13:53, Daniel wrote:
> be saved." - Rick C. Hodgin
 
> I think he's talking about you, Mr Flibble.
 
> Daniel
 
He may be talking about many people, including me. I've been declared
to be someone Rick will not answer, though I actually am not sure why.
Given all the useful advice I have posted for him, it is very much his
loss, not mine.
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Oct 30 04:52PM -0700

On Thursday, October 30, 2014 6:27:10 PM UTC-4, Christopher Pisz wrote:
> and you can see by his responses to why he didn't pass it by reference
> and why he returns (0) instead of returning 0, that he is a C style
> programmer....
 
I am a C-style programmer. I am currently working on development of
a new compiler somewhere between C and C++ called RDC (Rapid Development
Compiler).
 
I asked this in the C++ groups because I was using g++ to compile my
project. I was surprised by your response. You could've answered my
question by replying:
 
"The order of precedence is causing the pointer to be updated,
and not the value being pointed to."
 
That would've been singularly helpful.
 
FWIW, the example I gave was a minimally contrived example to
demonstrate the issue I was having. It was not intended to be
fantastically beautiful, but to demonstrate the same warning I
was getting. And I do appreciate your help. It's obvious in
retrospect. :-)
 
Best regards,
Rick C. Hodgin
Melzzzzz <mel@zzzzz.com>: Oct 31 01:03AM +0100

On Thu, 30 Oct 2014 13:42:51 -0700 (PDT)
 
> Why does g++ generate this warning?
 
It is useful. clang issues exactly same warning, too.
 
 
--
Manjaro all the way!
http://manjaro.org/
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Oct 30 05:10PM -0700

On Thursday, October 30, 2014 8:03:50 PM UTC-4, Melzzzzz wrote:
> "Rick C. Hodgin" <rick.c.hodgin@gmail.com> wrote:
> > Why does g++ generate this warning?
 
> It is useful. clang issues exactly same warning, too.
 
:-) It is useful. FWIW, Visual Studio 2008's C/C++ compiler did not
generate a warning. It compiled the code, and the disassembly showed
the same operation as g++ as the above GDB output.
 
Thanks, Microsoft. :-) But, the blame rests solely on my shoulders.
I should've known better. And, I actually do... it's just sometimes
that things happen. :-)
 
Best regards,
Rick C. Hodgin
jacob navia <jacob@spamsink.net>: Oct 31 02:38AM +0100

Le 30/10/2014 23:26, Christopher Pisz a écrit :
> (good)C++ programmers don't use #include <stdio.h>, (most)C programmers do.
 
Maybe, but that is completely irrelevant to this bug.
 
> (good) C++ programmers don't usually pass raw pointers to public methods
> or global functions, (most) C programmers do
 
C++ doesn't use pointers?
 
Yes, they do. Yes, C++ will let you have all kinds of abstractions about
pointers, smart ones, not so smart ones and stupid ones, that are just
that: pointers.
 
But that has nothing to do about the bug!
 
> before using it, (most) C programmers rely on foreknowledge and would
> say, "Well, we just know the pointer has to be initialized before using
> it", that's the way this API works.
 
No. Any reasonable C programmer in production code tests its inputs for
NULL, when that is required: a global function in this case.
 
But the bug would STILL be there if it was hidden in a completely local
environment
 
{ char *p = buffer; *p++; }
 
The bug is a misunderstanding by a programmer of how pointers work, what
is normal, since it is one of the most difficult things for newcomers to
C OR C++ to grasp.
 
 
> This was a very good example of how C style code creates unexpected
> errors.
 
There is no error at all! It is just that the value of an operation is
not used. It is the SAME as in C, by the way. C++ and C are exactly the
same with respect to this problem.
 
If he has passed the int by reference or by one of the many C++
> constructs to manage pointers, then the error would have never occurred.
 
And if he wouldn't have used any pointers at all the error would
disappear also. But you are looking at a SAMPLE CODE sent by the
programmer to ask a question about a warning he did not understand.
 
It is not production code!
 
> programmer, because he chalks it up to his personal preference and as is
> the case all too often with C style code, that personal preference made
> the code more error prone.
 
What makes his code go bad is a basic misunderstanding of pointers and
what dereferencing is. If he would have used any of the C++ methods you
point out, he would have never had this bug and would have never learned
how pointers work and why that construct is wrong.
 
What bothers me again in your answer is the implicit pejorative tone
before a simple error question.
 
Only the people that can't learn laugh at questions, be they so "stupid"
or "C like" as you want.
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Oct 30 07:03PM -0700

On Thursday, October 30, 2014 4:43:04 PM UTC-4, Rick C. Hodgin wrote:
> 03: *tnX++; // Changes only the pointer
> 04: ++*tnX; // Changes the thing pointed to
> 05: }
 
I've been thinking... I don't think *tnX++ should do what it does
in current C/C++ compilers. I think this reveals a flaw in the
expression parsing mechanism which exists for pointers, and its
dereferencing on stand-alone statements like this.
 
Consider that on line 03: above, the * operation is completely and
silently lost. GCC does not give any sort of warning about unreachable
code in the pointer operation, or of having an operation which has no
effect (with regards to the * part of the code), but only that the
altered parameter value on the stack was not used. When changed to
the form above, even that warning goes away.
 
This reveals a flaw that is a separate issue to the original warning,
one which, to me, is far more important. The pointer operation is
being totally and completely ignored. Silently.
 
I believe this code should actually act on the thing and not the
pointer value itself.
 
I'll have to consider this, and may make this a special case exception
in RDC that when there is *tnX++; as in a stand-alone form, the operation
is actually the same as ++*tnX, and actually to update the thing pointed
to, rather than the pointer.
 
Best regards,
Rick C. Hodgin
Louis Krupp <lkrupp@nospam.pssw.com.invalid>: Oct 30 08:46PM -0600

On Thu, 30 Oct 2014 19:03:42 -0700 (PDT), "Rick C. Hodgin"
>to, rather than the pointer.
 
>Best regards,
>Rick C. Hodgin
 
Don't do it. If you make an exception to the operator precedence
rules, you'll have programs breaking in surprising and mysterious
ways. Think of what will happen when somebody changes the expression
to:
 
n = *tnX++;
 
If tnX is suddenly incremented while before it wasn't, and *tnX is
unchanged while before it was incremented, you'll have violated the
Principle of Least Astonishment.
 
If you don't like the way current C/C++ compilers work, then you
should probably question how much you really like C or C++, and you
might want to make your new language look like something else. Lots
of people are not fond of C, and more people are less than thrilled by
C++. There are other languages out there to investigate or to be used
as models.
 
Louis
Richard Damon <Richard@Damon-Family.org>: Oct 30 07:50PM -0700

On 10/30/14, 7:03 PM, Rick C. Hodgin wrote:
> expression parsing mechanism which exists for pointers, and its
> dereferencing on stand-alone statements like this.
 
> Best regards, Rick C. Hodgin
 
The typical use for *p++ is in expressions (in loops) like
 
*p++ = 0; /* Clear a buffer */
 
or
 
*p1++ = *p2++; /* Copy a buffer */
 
In this case it make a lot of sense to have the priorities the way they
are.
 
Basically, having pointers into buffers you want to manipulate is more
common than a pointer to a simple variable you might want to increment.
(or that *++p would be more common than ++*p)
 
You always have the option to write it as: (*p)++ to modify the object
pointed to by the pointer.
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Oct 30 08:51PM -0700

On Thursday, October 30, 2014 10:46:50 PM UTC-4, Louis Krupp wrote:
> On Thu, 30 Oct 2014 19:03:42 -0700 (PDT), "Rick C. Hodgin"
> >in RDC that when there is *tnX++; as in a stand-alone form...
^^^^^^^^^^^^^^^^^^^^^^^^
 
> ways. Think of what will happen when somebody changes the expression
> to:
 
> n = *tnX++;
 
I did say "as in a stand-alone form" ... meaning it exists only on
a single line of source code by itself (as per my original example).
 
Your example would work properly in my compiler. The other example
posted after would work properly. I'm just saying ++*tnX would work
the same as *tnX++ when that is all that's on the source code line,
as being that one special case.
 
Best regards,
Rick C. Hodgin
Nobody <nobody@nowhere.invalid>: Oct 31 08:20AM

On Thu, 30 Oct 2014 19:03:42 -0700, Rick C. Hodgin wrote:
 
> in RDC that when there is *tnX++; as in a stand-alone form, the operation
> is actually the same as ++*tnX, and actually to update the thing pointed
> to, rather than the pointer.
 
Special-case exceptions are almost invariably a dumb idea, falling into
the category of "it seemed like a good idea at the time".
 
Even more so when the only reason for having it is that the developer
once made a mistake and would prefer to believe that the mistake was the
language's fault rather than his own.
David Brown <david.brown@hesbynett.no>: Oct 31 11:41AM +0100

On 31/10/14 02:38, jacob navia wrote:
> same with respect to this problem.
 
>> If he has passed the int by reference or by one of the many C++
>> constructs to manage pointers, then the error would have never occurred.
 
Yes, there was an error - Rick had written code with an error because he
misunderstood the precedence of the "*" and "++" operators. It is
common enough to make such mistakes, even for experienced C or C++
developers - personally, I am a fan of extra brackets or splitting up
the calculation in order to avoid such risks. The best solution, IMHO,
is to write "(*tnX)++;".
 
But if he had used a reference (as is common in C++ code), rather than a
pointer (which is common in C, and uncommon though still legal in C++),
then he could not possibly have made the same mistake. Using C++ style
coding in a C++ program would have avoided this error.
 
Now, it is fine for Rick to say he prefers the C style, even in C++
code. It is also fine to say using C++ style could have increased the
risks of other errors (such as the one Christopher made in his C++
examples). But /this/ particular error would have been avoided if Rick
had used C++ references.
David Brown <david.brown@hesbynett.no>: Oct 31 02:01PM +0100

On 31/10/14 01:10, Rick C. Hodgin wrote:
 
> Thanks, Microsoft. :-) But, the blame rests solely on my shoulders.
> I should've known better. And, I actually do... it's just sometimes
> that things happen. :-)
 
Check that you've got all warnings enabled, and also at least basic
optimisations - many compilers give better warnings when optimising code
(since they can track data flow better).
David Brown <david.brown@hesbynett.no>: Oct 31 02:10PM +0100

On 31/10/14 03:03, Rick C. Hodgin wrote:
 
> This reveals a flaw that is a separate issue to the original warning,
> one which, to me, is far more important. The pointer operation is
> being totally and completely ignored. Silently.
 
If you just have "*tnX", gcc will warn about that too.
 
There is always scope for more warnings in the compiler, but gcc gives
quite a number (when enabled).
 
> in RDC that when there is *tnX++; as in a stand-alone form, the operation
> is actually the same as ++*tnX, and actually to update the thing pointed
> to, rather than the pointer.
 
Re-consider it - you don't want the same expression to mean different
things when it is written alone, or part of another statement. It makes
a lot more sense to make sure you give a warning when something like
that expression is used on its own, rather than silently translating it
into something else. And if you like, make such warnings permanently
enabled rather than optional (as in gcc or clang).
Marcel Mueller <news.5.maazl@spamgourmet.org>: Oct 31 02:15AM +0100

With C++11 the standard containers like vector, deque etc. got a new
function emplace to construct new objects in place. Very useful, from my
point of view. I almost do not use anything else anymore.
 
But what about the other direction? How to remove objects with move
semantics? pop_back does not return anything, and there is no new
function which returns an rvalue reference. Did I miss something?
 
 
Marcel
Paavo Helde <myfirstname@osa.pri.ee>: Oct 30 11:08PM -0500

Marcel Mueller <news.5.maazl@spamgourmet.org> wrote in news:m2uns8$ohk$1
 
> But what about the other direction? How to remove objects with move
> semantics? pop_back does not return anything, and there is no new
> function which returns an rvalue reference. Did I miss something?
 
std::move()?
woodbrian77@gmail.com: Oct 30 09:24PM -0700

On Thursday, October 30, 2014 11:08:13 PM UTC-5, Paavo Helde wrote:
> > semantics? pop_back does not return anything, and there is no new
> > function which returns an rvalue reference. Did I miss something?
 
> std::move()?
 
Maybe use ::std::move on back() and then call pop_back().
 
 
Brian
Ebenezer Enterprises - In G-d we trust.
http://webEbenezer.net
JiiPee <no@notvalid.com>: Oct 31 12:12PM


> Brian
> Ebenezer Enterprises - In G-d we trust.
> http://webEbenezer.net
 
Yes it sounds logical the libraries should work this way. Or maybe they
should have a new method:
 
move_back which moves the object to caller :). But then too many member
in class maybe :)
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.