- Constructing const array out of constexpr function - 1 Update
- virtual method calls in constructors and destructors - 1 Update
- OT: Association for Orthodox Jewish Scientists - 13 Updates
- Those boolean contexts are bugging me! - 2 Updates
- Get and set file/folder ACLs using c/c++ - 1 Update
- Those boolean contexts are bugging me! - 1 Update
bitrex <bitrex@de.lete.earthlink.net>: Mar 18 07:18PM -0400 Suppose for the sake of argument I have following private constexpr in a class: static constexpr uint16_t square_it(uint16_t x) { return std::pow(x, 2); } Then I want to construct a static constant array of these values for the integers up to 255 in the same section of the same class using the above constexpr: static const uint16_t array_of_squares[256] = { //something }; What is the "proper" way to do this? |
Lynn McGuire <lmc@winsim.com>: Mar 18 05:55PM -0500 Well, I just got educated on virtual method calls in constructors and destructors. None will be executed as you think so that functionality will not work. It would be nice if the compiler would warn a person. http://stackoverflow.com/questions/12092933/calling-virtual-function-from-destructor and http://stackoverflow.com/questions/9114982/calling-virtual-method-from-destructor-workaround I devised a way to get around the virtual method call in the constructor by adding an argument to my base constructor which fixed that issue. But getting around the virtual method call in my destructor is painful. Lynn |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Mar 17 11:52PM > weaknesses also. G-d knows that I'm often a mess of pride, > lust and apathy. I'm paraphrasing something there from > the band switchfoot -- www.switchfoot.com . If you honestly think that Noah actually existed and the flood actually happened then you are beyond help mate. /Flibble |
Juha Nieminen <nospam@thanks.invalid>: Mar 18 10:17AM > Depression and isolation are nothing > new to the prophets and other biblical figures or to followers > of Yeshua. You are deliberately seeking for antipathy and hatred with your holier-than-thou attitude. You are self-victimizing. You revel in the backlash. It makes you feel virtuous and holy. It makes you feel special. You are deluding yourself, and deliberately making yourself an insufferable, annoying person. You are deliberately making people detest you. And for what? Do you honestly think you are receiving some kind of "heaven points" by doing that? You do honestly think that your "salvation" is dependent on you ostracizing yourself and annoying other people? Do you honestly think that your god will like you more when you make people hate you? Do you honestly think that your god wants you to be a self-imposed martyr? --- news://freenews.netfront.net/ - complaints: news@netfront.net --- |
David Brown <david.brown@hesbynett.no>: Mar 18 11:19AM +0100 > righteousness. Noah's preaching wasn't very successful > in terms of persuading people. Noah is faulted by some > of the sages: Suppose we assume for a moment that Noah existed, spend 120 years building the ark, etc., as though the Bible story was precise, literal and accurate history (and that is a /huge/ assumption, which very few people, even amongst dedicated Jews or Christians, actually believe). You are comparing yourself to Noah, and your "C++ Middleware C++ Writer" to the ark. The ark was what saved the entire human race, and every animal species on the planet, from being completely wiped out by God's fit of anger. Your project generates code to store C++ objects in files. With a quick googling, I could not find a single reference to the project that was not directly from you. Now, it may be a fine piece of code, and it may be useful to some people - but you are /not/ saving the world or the human race. So don't you think your comparison here is just a little bit unreasonable - perhaps a touch on the megalomaniac side? Oh, and being bad at proselytizing and preaching is not something to be proud of. Some people are good at that sort of thing, others are bad. You are bad - your religious posts will do more to chase away potential converts than to help win them to your side. So if you truly believe in your God, and truly believe that /everyone/ should also believe as you do, then please do the right thing - keep quite about it in a newsgroup like this. And if anyone asks you for information, point them in the direction of the nearest church, preacher, website, etc., and then keep quiet. But if you are in fact the devil in disguise, then maybe you want to continue to show people that religion turns your brain to mush, forces you to accept the blatantly impossible, and destroys your social skills. |
Melzzzzz <mel@zzzzz.com>: Mar 18 01:17PM +0100 On 3/18/16 11:19 AM, David Brown wrote: >> righteousness. Noah's preaching wasn't very successful >> in terms of persuading people. Noah is faulted by some >> of the sages: ... > You are comparing yourself to Noah, and your "C++ Middleware C++ Writer" > to the ark. No need to bash him. Post is harmless... |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Mar 18 04:32PM On 18/03/2016 12:17, Melzzzzz wrote: >> You are comparing yourself to Noah, and your "C++ Middleware C++ Writer" >> to the ark. > No need to bash him. Post is harmless... Coding needs to be an inclusive and, ideally, a mathematically and scientifically sound activity which means it should also be a secular activity. There are plenty of religiously themed newsgroups or Facebook to post religious bollocks to. /Flibble |
woodbrian77@gmail.com: Mar 18 11:34AM -0700 On Friday, March 18, 2016 at 5:17:09 AM UTC-5, Juha Nieminen wrote: > holier-than-thou attitude. You are self-victimizing. You revel > in the backlash. It makes you feel virtuous and holy. It makes > you feel special. Years ago I worked at IBM, American Express and Southwest Airlines. This was before they drifted away from the biblical understanding of marriage. In the 1990s I saw some of the junk that was coming down the pike so I started a company to escape from being compelled to contribute to things I think are wrong. Religious liberty is worth dying for. Remember the Alamo? (I don't think you are an American, but you can look it up if you want.) I started the company because my back was against the wall. Like the Israelites who were pursued by Pharoah, my only option was to trust G-d. That was in 1999. Since then G-d has helped me to build the company. > annoying other people? Do you honestly think that your god will > like you more when you make people hate you? Do you honestly think > that your god wants you to be a self-imposed martyr? Consider these verses: "He was despised and forsaken of men, A man of sorrows and acquainted with grief; And like one from whom men hide their face He was despised, and we did not esteem Him. Surely our griefs He Himself bore, And our sorrows He carried; Yet we ourselves esteemed Him stricken, Smitten of G-d, and afflicted." Isaiah 53:3,4 Many Bible believers, including myself, think those verses describe Yeshua/Jesus. At any rate, there's this example of a man who was rejected and considered to be a fool. "He played the fool and He opened our eyes." After Yeshua there was Paul. Paul was very blunt and not afraid to express himself. Some hated Paul and others loved him. I'm with those who loved him. What my views boil down to is that the ideal situation for children is to have a father and a mother. The diversity of a marriage with a man and a woman makes it strong. For example, what good are breasts that aren't producing milk to a baby? But breasts that are producing milk, due to a pregnancy, work great. See also www.dailywire.com www.dennisprager.com http://pragertopia.com/ www.onenewsnow.com for further defense of my views. Brian Ebenezer Enterprises - "In fact, everyone who wants to live a G-dly life in Messiah Yeshua (Jesus) will be persecuted" 2nd Timothy 3:12 http://webEbenezer.net |
Cholo Lennon <chololennon@hotmail.com>: Mar 18 04:29PM -0300 > http://pragertopia.com/ > www.onenewsnow.com > for further defense of my views. Why can't you understand that this is a group about C++, not a religion one? We don't want your religious views here! Why you preach about your beliefs in every post? I am sick and tired of you. I am agnostic, can you respect that? Although I don't like religions, I always respect all religious people, but there is a limit, this is the limit. The old saying "your rights end where mine begin" is applicable here. You are sick man, really sick, your head is not working. You are a fanatical, a bigot. Let's talk about programming, yes? -- Cholo Lennon Bs.As. ARG |
scott@slp53.sl.home (Scott Lurndal): Mar 18 07:54PM >> in the backlash. It makes you feel virtuous and holy. It makes >> you feel special. >Years ago I worked at IBM, American Express and Why do you think anyone in comp.lang.c++ gives a shit? |
Gareth Owen <gwowen@gmail.com>: Mar 18 08:08PM > Israelites who were pursued by Pharoah, my only option was to trust > G-d. That was in 1999. Since then G-d has helped me to build the > company. IBM, American Express and Southwest Airlines have a combined operating income of $26 billion. It seems that God has helped them a lot more. Could it be that not being a judgmental asshole is more pleasing to God? |
woodbrian77@gmail.com: Mar 18 02:59PM -0700 On Friday, March 18, 2016 at 3:08:40 PM UTC-5, gwowen wrote: > IBM, American Express and Southwest Airlines have a combined operating > income of $26 billion. It seems that God has helped them a lot more. David against Goliath. > Could it be that not being a judgmental asshole is more pleasing to God? If speaking up for babies and children is being judgmental, so be it. Brian |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Mar 18 10:02PM >> Could it be that not being a judgmental asshole is more pleasing to God? > If speaking up for babies and children is being > judgmental, so be it. Ah thanks for reminding us that not only are you a religious bigot you are a homophobic misogynist religious bigot. You failed to answer my earlier question Brian: God has cuntflaps doesn't she? /Flibble |
woodbrian77@gmail.com: Mar 18 03:11PM -0700 On Friday, March 18, 2016 at 5:02:22 PM UTC-5, Mr Flibble wrote: Leigh, you are an anti-religious bigot. Brian |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Mar 18 10:16PM > On Friday, March 18, 2016 at 5:02:22 PM UTC-5, Mr Flibble wrote: > Leigh, you are an anti-religious bigot. Being anti-religious isn't bigoted because being anti-religion isn't unreasonable mate. /Flibble |
Alain Ketterlin <alain@universite-de-strasbourg.fr.invalid>: Mar 18 11:04AM +0100 > { double x; bool ok; do > { if( ::std::cin >> x ) ... > . It compiles fine. [...] > error: cannot convert > 'std::basic_istream<char>::__istream_type {aka > std::basic_istream<char>}' to 'bool' in assignment "if ( bool ok = ... )" compiles fine. "if ( ok = bool(...) )" compiles fine. Before C++11 there was no operator bool() (it was operator void*()) Since C++11 it is "explicit operator bool()" Regarding conditions for if statements, (N4296, 6.4§3) says: "The value of a condition that is an initialized declaration in a statement other than a switch statement is the value of the declared variable contextually converted to bool (Clause 4). [...] The value of a condition that is an expression is the value of the expression, contextually converted to bool for statements other than switch [...]" Then, (6.4§5) says: "If a condition can be syntactically resolved as either an expression or the declaration of a block-scope name, it is interpreted as a declaration." So "if ( bool ok = cin>>x )" (an initialized declaration) and "if ( cin>>x )" (an expression, interpreted as a declaration) are treated the same, and both match the requirements of an explicit constructor. (I would call the latter an "implicitly explicit construction" :-) In contrast, "if ( ok = cin>>x )" tries to do two things: 1) evaluate cin>>x (returning an istream&) 2) assign to a bool The assignment fails, because it requires a conversion that is not explicit. Making it explicit (ok = bool(cin>>x)) solves the problem, as noted above. There is no need for an "if" statement to exhibit the problem: ok = cin>>x; fails to compile as well. My conclusion is that the explicit qualifier on "istream::operator bool()" is the cause of the error. Does that sound plausible? Thanks for the example. -- Alain. |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Mar 18 06:38PM +0100 On 18.03.2016 05:04, Stefan Ram wrote: > { if( ::std::cin >> x ) ... > . It compiles fine. I used to believe that »::std::cin >> x« > was being evaluated in some kind of »boolean context«. It is, it is a /condition/. > int main() > { double x; bool ok; do > { if( ok = ::std::cin >> x )... Now it's the complete assignment expression that is a /condition/. The invocation of >> is not. > std::basic_istream<char>}' to 'bool' in assignment > . Why can't he (gcc 5.1.1 -std=c++17) convert it (::std::cin > >> x) to bool anymore? Because from C++11 and onward the conversion is an `explicit` `operator bool`, which [1]can only be invoked implicitly for a /condition/. With C++03 it was however just an implicit conversion to `void*`, so with C++03 the code should compile. Maybe you can test that by using `-std=c++03`. • • • Silly thing: the choice expression in a `switch` is also a /condition/. Cheers & hth., - Alf Notes: [1] Instead of using a cast or a bang-bang, I would write `not (cin >> x).fail()`). It's more verbose but far more clear. Explicit = good. :) |
Zeljko Radicevic <zeljko.radicevc@gmail.com>: Mar 18 09:14AM +0100 On 03/17/2016 05:50 PM, red floyd wrote: >> programming languange? >> I'm looking for some simple example > 1. There is no such language as C/C++. There is C, and there is C++. for me it does not matter in which the programming language C or C ++ is written, it is important to do their job, so I wrote the C/C ++ > 2. The ISO standard for C++ does not mention "file/folder ACLs". What > you are looking for is a newsgroup with either "linux" or "unix" > in its name. Thank you |
ram@zedat.fu-berlin.de (Stefan Ram): Mar 18 04:04AM I have this program: #include <iostream> #include <ostream> #include <istream> int main() { double x; bool ok; do { if( ::std::cin >> x ) ... . It compiles fine. I used to believe that »::std::cin >> x« was being evaluated in some kind of »boolean context«. So I tried this slight modification, inserting »ok = «. #include <iostream> #include <ostream> #include <istream> #include <limits> int main() { double x; bool ok; do { if( ok = ::std::cin >> x )... But now I get this message: error: cannot convert 'std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}' to 'bool' in assignment . Why can't he (gcc 5.1.1 -std=c++17) convert it (::std::cin |
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