- My new project - 1 Update
- A decent read/write mutex... - 1 Update
- vector<double> hour {vector<double>(24, -7777)}; <--> vector<double> hour(24, -7777); - 5 Updates
- Printing a calander. - 1 Update
- vector<double> hour {vector<double>(24, -7777)}; <--> vector<double> hour(24, -7777); - 3 Updates
- Safe overnight delivery....Soma 350mg Adderall 30mg Ritalin 10mg Tramadol ( Ultram) 50mg ibrpohen advil pm Atarax 25mg viagra gold FIORICET (BUTALBITOL 50MG) - MIKART Hydrocodone 539 Roxicodone 15mg - 1 Update
"Chris M. Thomasson" <invalid@invalid.invalid>: Apr 24 02:55PM -0700 On 4/20/2017 9:28 PM, Alf P. Steinbach wrote: > On 21-Apr-17 6:01 AM, rami17 wrote: [...] > better feedback, at least in the clc++ newsgroup, if you present these > things as your exploration of issues, not as your gifts to other > programmers, and ask for feedback as a student. This is sage advise Alf! |
"Chris M. Thomasson" <invalid@invalid.invalid>: Apr 24 02:50PM -0700 On 4/19/2017 4:28 PM, Chris M. Thomasson wrote: > } > mb_fence(mb_seq_cst); > } [...] > _______________________________ > Will have normal std c++ in a day or two. Posted here, for all of the > wonderful contributors and readers of this fine group. Take a look at the wrlock function with that damn annoying seq_cst barrier. Well, I managed to make it conditional wrt: ____________________________ void wrlock() { if (m_wrstate.fetch_sub(1, mb_relaxed) < 1) { m_wrlockset.sub(1); } int count = m_count.fetch_add(-INT_MAX, mb_relaxed); if (count < INT_MAX) { if (m_rdwake.fetch_add(INT_MAX - count, mb_relaxed) + INT_MAX - count) { m_wrwset.sub(1); } mb_fence(mb_seq_cst); } else { mb_fence(mb_acquire); } } ____________________________ Big difference: Especially for x86 platforms! Yeah! |
Christiano <christiano@engineer.com>: Apr 24 06:01AM -0300 I'm reading a book which has the following code: ---Book----------------------------------- struct Day { vector<double> hour {vector<double>(24, -7777)}; } ------------------------------------------ And he explains: --Book------------------------------------ Why didn't we write struct Day { vector<double> hour {24, -7777}; }; ? That would have been simpler, but unfortunately, we would have gotten a vector of two elements (24 and -1). When we want to specify the number of elements for a vector for which an integer can be converted to the element type, we unfortunately have to use the () initializer syntax. ------------------------------------------ Ok, I understand what he is saying. But is not the following code better? struct Day { vector<double> hour(24, -7777); } Is there any special reason why he chose to write in this way rather than in the simplest form? Book ISBN 978-0-321-99278-9 |
Christiano <christiano@engineer.com>: Apr 24 06:15AM -0300 On 04/24/17 06:01, Christiano wrote: > Is there any special reason why he chose to write in this way rather > than in the simplest form? Clarifying "in this way" means: struct Day { vector<double> hour {vector<double>(24, -7777)}; } "simplest form" means: struct Day { vector<double> hour(24, -7777); } |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Apr 24 02:45PM +0200 On 24-Apr-17 11:01 AM, Christiano wrote: > struct Day { > vector<double> hour(24, -7777); > } It would be simpler if that syntax were supported. Initializers for data members were added as an afterthought in C++11, to avoid the redundancy of specifying the same initialization in each constructor. The standardization committee had to work within the existing awkward syntax where round parenteses have just too many meanings, e.g. yielding the so called "most vexing parse" of C++. They chose to support only curly braces initializers, in two forms: direct initialization `T m{...}` and copy initialization `T m = {...}`. > Is there any special reason why he chose to write in this way rather > than in the simplest form? I imagine it's for pedagogical purposes, to illustrate the point above. Otherwise, just write struct Day { array<double, 24> hour{}; }; with the values initialized to 0. IMHO that's roughly the simplest form, except that the purpose of this struct is unclear. Cheers & hth., - Alf |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Apr 24 02:50PM +0200 On 24-Apr-17 2:45 PM, Alf P. Steinbach wrote: > the so called "most vexing parse" of C++. They chose to support only > curly braces initializers, in two forms: direct initialization `T > m{...}` and copy initialization `T m = {...}`. Sorry, that was an awkward and misleading formulation. You /can/ write struct S { int x = 1; }; and you can write struct S { int x{ 1 }; }; but not -- there's no syntax for it -- struct S { int x( 1 ); }; Cheers!, - Alf (now heading for coffee) |
Christiano <christiano@engineer.com>: Apr 24 06:37PM -0300 On 04/24/17 09:50, Alf P. Steinbach wrote: > }; > Cheers!, > - Alf (now heading for coffee) My mistake. I assumed it would work without taking the test before. The code bellow doesn't work: struct X { vector<int> a(20, -7777); }; And the two codes bellow work: struct X { vector<int> a = vector<int>(20, -7777); }; struct X { vector<int> a {vector<int>(20, -7777)}; }; But using clang version 3.8.0 only works when using -std=c++11. Thank you, Alf and Stefan. |
Jeff-Relf.Me @.: Apr 24 11:40AM -0700 |
ram@zedat.fu-berlin.de (Stefan Ram): Apr 24 09:29AM Christiano <christiano@engineer.com> did NOT write exactly this: |vector< double >hour{ vector< double >( 24, -77 )}; |vector< double >hour{ 24, -77 }; |vector< double >hour( 24, -77 ); No, the last line has about the same effect as the first line but is clearer (shorter). The first could be used if there is a style rule active that requires every declared identifier to followed by a brace or it could be a preparation for a use of auto: auto hour{ vector< double >( 24, -77 )}; . |
udpbot <bleachbot@httrack.com>: Apr 24 04:35PM +0200 |
ram@zedat.fu-berlin.de (Stefan Ram): Apr 24 06:01PM >|vector< double >hour( 24, -77 ); >No, the last line has about the same effect as the >first line but is clearer (shorter). After reading Alf, I have to add that I have failed to take into account that the initialization with parentheses is not allowed when a member of class is to be initialized at the place of its declaration in the class specifier. |
Legit Deals <no_email@invalid.invalid>: Apr 24 02:35PM Prescription Medications Call or Text 231-534-6894 ( Trusted Manufacturers) WE OFFER DISCREET OVERNIGHT SHIPMENTS TO BUYERS IN USA AND CANADA AND 48-72 HOURS DELIVERY TO BUYERS IN EUROPE AND ASIA DEPENDING ON YOUR LOCATION. WE DO PROVIDE TRACKING NUMBERS AS PROOF OF SHIPMENTS SO YOU CAN TRACK YOUR PARCELS TIMELY. SO IF INTERESTED JUST CONTACT US NOW FOR INSTANT RESPONSE Customer service. -EMAIL : keystonemeds@protonmail.com / -Tel: +1(213) 5346894 / -Get W1ckr App and message Us at W1ckr ID: intermeds247 Benefits of our service: We are a reliable supplier/shipper to fill your daily online orders from customers around the world as well as supply your wholesale business with bulk orders.Our company has an extensive list on medications and can provide all shipping options like (Regular post, EMS, DHL. UPS. ) Help Desk EMAIL : keystonemeds(AT)protonmail(DOT)com / -Tel: +1(213) 5346894 / -Download W1ckr App and message Us at W1ckr ID: intermeds247 -Xanax -Ritalin -Activan -oxycondon -oxycontin -Valium -Actiq -Bulytone (bk-MBDB) -Flephedrone -Butylone (bk-MBDB ) -Barbiturates -methadone -Benzodiazepines -Amphetamine -Buprenorphine -Solvents -HGH -Methylone Crystals -Methylone Powder -Ketamine HCL -AICAR Powder -AICAR Pills -GW1516 Powder -GW 501516 Pills -Ephedrine -Mephedrone Powder -Mephedrone Crystal -4-CMC / Clephedrone -Synthacaine -Dimethocaine -Amphetamine Powder -Amphetamine Crystal -Ethylone -sibutramine Gamma-Butyrolactone (GBL) Powder Gamma-Butyrolactone (GBL) Liquid / lactone Gamma Hydroxybutyrate (GHB) Powder Gamma Hydroxybutyrate (GHB) Liquid Gamma Hydroxybutyrate (GHB) Pills N,N-Dimethyltryptamine (DMT) 4-Aco-DMT 4-MeO-DMT 5-Meo-DMT -Benzo Fury -MDMA Powder -Mephedrone Pills -Nembutal Pentobarbital Liquid Nembutal Pentobarbital Powder Nembutal Pentobarbital Pills -Crystal Meth Ice -Ketamine -Heroin -Cocaine -MDMA -LSD -Oxycodone-A215 -Oxycontin -Adderall -Xanax -Opana -MDMA Pills(Ecstasy Pills) -Morphine -Actavis Promethazine Cough Syrup with codeine Medicated Marijuana....all strain...Grade A Cocaine -ketamine -LSD -Heroin -Codeine -Medical Marijuana -Tobacco -MDPV -Mephedrone -Mdma -Ecstasy -Mdai -Methedrone -Methylone -diabetes meds -infidelity meds -methamphetamine -Percocet -Klonopin -Dilaudid -Ecstasy Delivery is 100% safe due to our discreetness and experience.Try our quality and experience then have a story to tell another day. EMAIL : keystonemeds(AT)protonmail(DOT)com / -Tel: +1(213) 5346894 / -Download W1ckr App and message Us at W1ckr ID: intermeds247 PLEASE ONLY SERIOUS BUYERS ARE WELCOME |
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