public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Sergei Gavrikov <sergei.gavrikov@gmail.com>
To: Grant Edwards <grant.b.edwards@gmail.com>
Cc: eCos Discuss <ecos-discuss@ecos.sourceware.org>
Subject: Re: [ECOS] Re: Why does #include <cyg/io/eth/eth_drv> define a bunch of time-related symbols?
Date: Tue, 25 Jun 2013 23:13:00 -0000	[thread overview]
Message-ID: <alpine.DEB.2.00.1306260135110.18706@sg-laptop> (raw)
In-Reply-To: <kqcjfk$h6m$1@ger.gmane.org>

Hi Grant

On Tue, 25 Jun 2013, Grant Edwards wrote:

> On 2013-06-25, Grant Edwards <grant.b.edwards@gmail.com> wrote:
> 
> > I'm working on a new Ethernet driver.  eCos kernel/libs (including the
> > new drive) build fine. But, when I try to link an application I get a
> > bunch of errors because some time-related functions are defined twice.
> > They're defined in libtarget where they're supposed to be, but they're
> > also getting defined in the object file for my Ethernet driver [and I
> > can't figure out why].
 
I guess you catch some kind of "Library Issue"

  http://gcc.gnu.org/c99status.html

> It's cause by compiling the driver with the -std=gnu99 flag.  I a big
> fan of limiting the scope of variables and like to use this sort of
> construct:
> 
>   for (int i=0; i<whatever; ++i)
>     {
>       // "i" is only visible inside this block    
>     }
> 
> It appears that eCos header files don't work right when you compile
> with C99 semantics...

Not only libraries. Many people (me too) are surprised when they look at
this table http://en.wikipedia.org/wiki/C99#Implementations -- very few
compilers are ready for C99.

Of course, if you (your fingers :-) have a habit... Well, you know about
C and C++ mix in eCos. If you like for-scope declarations then you would
use standard C with a bit of C++ sugar instead C99, eCos way:

  % grep -Er '\<for\>\s+?\(\s+?\<int\>' $ECOS_REPOSITORY

Though then here and there human can miss the needed extern "C"
declarations and that is a penalty for the only one C99 habit.

Sergei

> -- 
> Grant Edwards               grant.b.edwards        Yow! I just forgot my whole
>                                   at               philosophy of life!!!
>                               gmail.com            
> 
> 
> -- 
> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
> 

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

  reply	other threads:[~2013-06-25 23:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-25 16:52 [ECOS] " Grant Edwards
2013-06-25 17:20 ` [ECOS] " Grant Edwards
2013-06-25 23:13   ` Sergei Gavrikov [this message]
2013-06-26 14:01     ` Grant Edwards

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.00.1306260135110.18706@sg-laptop \
    --to=sergei.gavrikov@gmail.com \
    --cc=ecos-discuss@ecos.sourceware.org \
    --cc=grant.b.edwards@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).