This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Disable libcpp With GCC 4.8?


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.
>
> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]