Received: from nobody by stodi.digitalkingdom.org with local (Exim 4.80.1) (envelope-from ) id 1XZiwT-0004Ek-Sn for lojban-newreal@lojban.org; Thu, 02 Oct 2014 09:09:21 -0700 Received: from hostinglocation.sxczgs.com ([138.128.10.5]:40812) by stodi.digitalkingdom.org with esmtp (Exim 4.80.1) (envelope-from ) id 1XZiwN-0004Dp-Ef for lojban@lojban.org; Thu, 02 Oct 2014 09:09:19 -0700 Date: Thu, 02 Oct 2014 09:09:07 -0700 To: Subject: Unmotivated? Do all your efforts fail? Reply-to: Message-ID: <20141002011020.22923.5445host20141002011020.22923.5445@hostinglocation.sxczgs.com> From: LoseYourtummy Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-Spam-Score: -1.7 (-) X-Spam_score: -1.7 X-Spam_score_int: -16 X-Spam_bar: -

Woman'sHealth Guide - Second Edition
Good Housekeeping Featuring Dr.Oz

Hey Lojban,

Are you eating well and exercising, but your scale just won't budge .Or it's going up..?

Desperate attempts to slim-down can be so frustrating and create a real stress in our lives. In fact, I'll go as far as saying that losing-LBs is the NUMBER ONE stress for women I know.

Truth is, You can actually drop 21/month without doing much of anything.
Let me explain: http://www.sxczgs.com/rearing/skipperage/rationalizations.htm

Busy this afternoon so it'll be a burger on the grill, some sliced tomatoes and a beer. Later this evening there will be cold milk and snickerdoodles for dessert.

Thanks,
Team Oz (Good Housekeeping Edition)

 

 

Please note: This is recommended if you want to lose 10 or more:
http://www.sxczgs.com/rearing/skipperage/rationalizations.htm





Please use this method if you would liek to stop-communicaiton with our experts.
You can either write or go to this locaiton. WH-Second Edition - Nine Deen Stret, New Castle, DE

 

 

Even though October is not typically thought of as prime tornado season in this part of the country, the ingredients will be present for severe thunderstorms and a few tornadoes through Thursday in parts of the nation's heartland. Some of these areas were hit by destructive tornadoes during the first week of October last year.

 

Severe Weather Forecast: Large Hail, a Few Tornadoes, Heavy Rain in the Plains, Mississippi Valley

 

All tornado warnings, along with other relevant information from The Weather Channel and local National Weather Service offices in current threat areas, will appear here. Information updates automatically; no need to reload or refresh your browser. Time stamps on the left are in Eastern time; subtract one hour for Central time, two hours for Mountain time and three hours for Pacific time. For complete warning information and radar links, scroll above to see the radar imagery and clickable severe weather alerts links.

 

 

0x100000f5e:  leaq   0x35(%rip), %rdi          ; "%d %d" 0x100000f65:  movl   $0x4, %esi 0x100000f6a:  movl   $0x8, %edx 0x100000f6f:  xorl   %eax, %eax 0x100000f71:  callq  0x100000f7a               ; symbol stub for: printf

My question: is it guaranteed by the standard thatlengthfunction will be evaluated compile time?

If this is true the door for compile time string literals computations just opened for me... for example I can compute hashes at compile time and many more...

c++c++11standardsconstexprstring-literals
share|improve this question
editedSep 20 at 17:52
Shafik Yaghmour
48k 9 85 132
askedSep 17 at 12:38
Felics
5,368 5 44 98
3
As long as the parameter is a constant expression, it must be.chrisSep 17 at 12:42
1
@chris Is there a guarantee that something that can be a constant expressionmustbe evaluated at compile time when used in a context that doesn't require a constant expression?T.C.Sep 17 at 12:43
9
BTW, including<cstdio>and then calling::printfis non-portable. The standard only requires<cstdio>to providestd::printf.Ben VoigtSep 17 at 12:43
@BenVoigt Ok, thanks for pointing that out:) Initially I used std::cout, but the generated code was pretty big to find the actual values:)FelicsSep 17 at 12:46
2
@Felics I often usegodboltwhen answering questions dealing with optimization and usingprintfcan lead to significantly less code to deal with.Shafik YaghmourSep 20 at 17:58

 

activeoldestvotes
up vote45down voteaccepted

Constant expressions are not guaranteed to be evaluated at compile time, we only have a non-normative quote fromdraft C++ standardsection5.19Constant expressionsthat says this though:

[...]>[ Note: Constant expressions can be evaluated during translation.end note ]

You can assign the result toconstexprvariable to be sure it is evaluated at compile time, we can see this fromBjarne Stroustrup's C++11 referencewhich says (emphasis mine):

In addition to be able to evaluate expressions at compile time, we want to be able torequire expressions to be evaluated at compile time; constexpr in front of a variable definition does that(and implies const):

For example:

constexpr int len1 = length("abcd") ;

Bjarne Stroustrup gives a summary of when we can assure compile time evaluation in thisisocpp blog entryand says:

[...]The correct answer - as stated by Herb - is that according to the standard a constexpr function may be evaluated at compiler time or run time unless it is used as a constant expression, in which case it must be evaluated at compile-time. To guarantee compile-time evaluation, we must either use it where a constant expression is required (e.g., as an array bound or as a case label) or use it to initialize a constexpr. I would hope that no self-respecting compiler would miss the optimization opportunity to do what I originally said: "A constexpr function is evaluated at compile time if all its arguments are constant expressions."

So this outlines two cases where it should be evaluated at compile time:

  1. Use it where a constant expression is required, this would seem to be anywhere in the draft standard where the phraseshall be ... converted constant expressionorshall be ... constant expressionis used, such as an array bound.
  2. Use it to initialize aconstexpras I outline above.