This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Disable libcpp With GCC 4.8?
- From: Ian Lance Taylor <iant at google dot com>
- To: Cyd Haselton <chaselton at gmail dot com>
- Cc: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Fri, 25 Oct 2013 11:33:52 -0700
- Subject: Re: Disable libcpp With GCC 4.8?
- Authentication-results: sourceware.org; auth=none
- References: <CAHu5PrbCvk8Vkt2byYu84tuAsb0vHE9PnQxp-Z7Fgyg2NGvwyQ at mail dot gmail dot com> <CAKOQZ8yzFWEskJ7F0+k7OYgF5v4Os-eL7ET-hK5wZmY2fUObyA at mail dot gmail dot com> <CAHu5PraGPfn-RRWXWQCY444-5iKDN-oPHBqxfJ9XRaFOUHsOfg at mail dot gmail dot com> <CAKOQZ8wVAKNKnBp=Siz1MBHHW95x=aqUEp9rQ20hzRLd_PngOg at mail dot gmail dot com> <CAHu5PrZy8BU6wxnZ6eqciRTJYoxdQQkXyXtnyTpibHf83gYrTw at mail dot gmail dot com> <CAKOQZ8zA_PNoUk0HbPUAQoZ0V6=-Rz95O4wpKA5xNi2XckM8Qg at mail dot gmail dot com> <CAHu5PraXt6oE_FPRrZyxq1EF-x8P+-k=AmR=JmTv0Qc16TV5LA at mail dot gmail dot com>
On Fri, Oct 25, 2013 at 11:25 AM, Cyd Haselton <chaselton@gmail.com> wrote:
> Stupid, stupid gmail interface. Once again, reposting to entire group:
>
> *snip*
>>>
>>> *snip*
>>> struct tm *tb = NULL;
>>> struct stat *st = _cpp_get_file_stat (file);
>>> if(st)
>>> time_t t = (time_t) st->st_mtime;
>>> tb = localtime (&t);
>>> /* tb= localtime (&st->st_mtime); */
>>
>> I'm guessing that you are used to Python? In C you need braces:
>>
>> if(st)
>> {
>> time_t t = (time_t) st->st_mtime;
>> tb = localtime (&t);
>> /* tb= localtime (&st->st_mtime); */
>> }
>
> Not really, but I understand the concept. But...and I went back and
> checked the original source file to make absolutely sure...there's no
> braces around that if statement. Here's a copy and paste of the
> original code:
>
> if (file)
> {
> /* super long comment. */
> struct tm *tb = NULL;
> struct stat *st = _cpp_get_file_stat (file);
> if (st)
> tb = localtime (&st->st_mtime);
> if (tb)
> {
>
> I can add them...I didn't before because, well, they weren't there.
Yes. In C, the syntax of an if statement is
"if" "(" <condition> ")" <statement>
A <statement> may be a single statement or it may be a brace-enclosed
block.
If you expect to proceed along these lines I really have to urge you
to learn C. C is a simple language, easy to learn if you already know
how to program. (C++, on the other hand, is quite complex.)
Ian
>>
>> Ian
>
> On Fri, Oct 25, 2013 at 12:54 PM, Ian Lance Taylor <iant@google.com> wrote:
>> On Fri, Oct 25, 2013 at 8:59 AM, Cyd Haselton <chaselton@gmail.com> wrote:
>>>
>>> Just to clarify...adding the snippet you provided (thank you very
>>> much...by the way) to the code as follows should **not** throw an 'not
>>> declared in scope' error?
>>>
>>> *snip*
>>> struct tm *tb = NULL;
>>> struct stat *st = _cpp_get_file_stat (file);
>>> if(st)
>>> time_t t = (time_t) st->st_mtime;
>>> tb = localtime (&t);
>>> /* tb= localtime (&st->st_mtime); */
>>
>> I'm guessing that you are used to Python? In C you need braces:
>>
>> if(st)
>> {
>> time_t t = (time_t) st->st_mtime;
>> tb = localtime (&t);
>> /* tb= localtime (&st->st_mtime); */
>> }
>>
>> Ian