Gtk-app-devel-list Archive

List Statistics

  • Total Threads: 1015
  • Total Posts: 2519

Phrases Used to Find This Thread

  #1  
17-02-2011 12:27 PM
Gtk-app-devel-list member admin is online now
User
 

Hi,

I am using g_remove to remove some temporary files from the /tmp folder.
It is working as expected. Yet, gcc is complaining that I am making an
implicit declaration. What is up with this?

Craig Bakalian

_______________________________________________
___________________________________________________

Posted on the Gtk-app-devel-list mailing list. Go to mail.gnome.org/mailman/listinfo/guppi-list/..//gtk-app-devel-list to subscribe.

  #2  
17-02-2011 12:29 PM
Gtk-app-devel-list member admin is online now
User
 

On 17 February 2011 12:27, Craig Bakalian <> wrote:
> Hi,
>
> I am using g_remove to remove some temporary files from the /tmp folder.
> It is working as expected. Yet, gcc is complaining that I am making an
> implicit declaration. What is up with this?

You've not #include-ed the necessary files?
_______________________________________________
___________________________________________________

Posted on the Gtk-app-devel-list mailing list. Go to mail.gnome.org/mailman/listinfo/guppi-list/..//gtk-app-devel-list to subscribe.

  #3  
17-02-2011 05:45 PM
Gtk-app-devel-list member admin is online now
User
 

Hi,

I have gtk and glib as includes? Am I missing something? If there
wasn't the right include, the build would fail, further, the function
wouldn't remove the file.

Craig Bakalian


On Thu, 2011-02-17 at 12:29 +0000, James Morris wrote:
> On 17 February 2011 12:27, Craig Bakalian <> wrote:
> > Hi,
> >
> > I am using g_remove to remove some temporary files from the /tmp folder.
> > It is working as expected. Yet, gcc is complaining that I am making an
> > implicit declaration. What is up with this?
>
> You've not #include-ed the necessary files?


_______________________________________________
___________________________________________________

Posted on the Gtk-app-devel-list mailing list. Go to mail.gnome.org/mailman/listinfo/guppi-list/..//gtk-app-devel-list to subscribe.

  #4  
17-02-2011 05:56 PM
Gtk-app-devel-list member admin is online now
User
 

On Thu, Feb 17, 2011 at 12:45:36PM -0500, Craig Bakalian wrote:
> I have gtk and glib as includes? Am I missing something?

Yes, on Unix the g_-wrappers are often just macros resolving to the
underlying system function. So you need to

#include

to get the real declarations (dunno why it's not done automatically in
this case).

> If there
> wasn't the right include, the build would fail, further, the function
> wouldn't remove the file.

On the contrary, unless you pass -Werror=implicit-function-declaration
or an equivalent of that to the compiler the missing declaration just
causes a warning. The compiler then implicitly constructs the prototype
as `takes whatever argument you happen to pass to it and returns int'
which is sufficiently right here and the program works fine. All
according to the C standard.

Regards,

Yeti

_______________________________________________
___________________________________________________

Posted on the Gtk-app-devel-list mailing list. Go to mail.gnome.org/mailman/listinfo/guppi-list/..//gtk-app-devel-list to subscribe.

  #5  
17-02-2011 07:11 PM
Gtk-app-devel-list member admin is online now
User
 

Hi David and KC,

The did the trick. But it is odd behavior.

#include was already in my includes.

Craig Bakalian


On Fri, 2011-02-18 at 02:00 +0800, KC wrote:
> Try to add include
>
> KC
>
> On Fri, Feb 18, 2011 at 1:45 AM, Craig Bakalian
> <> wrote:
> > Hi,
> >
> > I have gtk and glib as includes? Am I missing something? If there
> > wasn't the right include, the build would fail, further, the function
> > wouldn't remove the file.
> >
> > Craig Bakalian
> >
> >
> > On Thu, 2011-02-17 at 12:29 +0000, James Morris wrote:
> >> On 17 February 2011 12:27, Craig Bakalian <> wrote:
> >> > Hi,
> >> >
> >> > I am using g_remove to remove some temporary files from the /tmp folder.
> >> > It is working as expected. Yet, gcc is complaining that I am making an
> >> > implicit declaration. What is up with this?
> >>
> >> You've not #include-ed the necessary files?
> >
> >
> > _______________________________________________
___________________________________________________

Posted on the Gtk-app-devel-list mailing list. Go to mail.gnome.org/mailman/listinfo/guppi-list/..//gtk-app-devel-list to subscribe.

  #6  
17-02-2011 07:18 PM
Gtk-app-devel-list member admin is online now
User
 

Craig Bakalian wrote:
> The did the trick. But it is odd behavior.

It is not odd. Read David's e-mail for a full explanation. If it is
still not clear, you should read the gcc man pages for warning options.
_______________________________________________
___________________________________________________

Posted on the Gtk-app-devel-list mailing list. Go to mail.gnome.org/mailman/listinfo/guppi-list/..//gtk-app-devel-list to subscribe.

  #7  
17-02-2011 07:46 PM
Gtk-app-devel-list member admin is online now
User
 

On Thu, Feb 17, 2011 at 9:11 PM, Craig Bakalian
<> wrote:
> Hi David and KC,
>
> The did the trick.  But it is odd behavior.
>
> #include was already in my includes.

Then g_remove must be a macro for a function in glib/gstdio.h, not stdio.h.
_______________________________________________
___________________________________________________

Posted on the Gtk-app-devel-list mailing list. Go to mail.gnome.org/mailman/listinfo/guppi-list/..//gtk-app-devel-list to subscribe.

  #8  
17-02-2011 07:57 PM
Gtk-app-devel-list member admin is online now
User
 

On Thu, Feb 17, 2011 at 09:46:14PM +0200, Costin Chirvasuta wrote:
> On Thu, Feb 17, 2011 at 9:11 PM, Craig Bakalian
> <> wrote:
> > Hi David and KC,
> >
> > The did the trick.  But it is odd behavior.
> >
> > #include was already in my includes.
>
> Then g_remove must be a macro for a function in glib/gstdio.h, not stdio.h.

Ah, then I misunderstood which case it is...

To summarise both:

- glib/gstdio.h is not automatically included with glib.h, it must be
included explicitly (as shown in Synopis in the docs)

- if you include glib/gstdio.h you also have to include stdio.h as
glib/gstdio.h may not actually declare the prototypes

Yeti

_______________________________________________
___________________________________________________

Posted on the Gtk-app-devel-list mailing list. Go to mail.gnome.org/mailman/listinfo/guppi-list/..//gtk-app-devel-list to subscribe.

  #9  
17-02-2011 08:52 PM
Gtk-app-devel-list member admin is online now
User
 

Le 17/02/2011 20:46, Costin Chirvasuta a écrit :
> On Thu, Feb 17, 2011 at 9:11 PM, Craig Bakalian
> <> wrote:
>> Hi David and KC,
>>
>> The did the trick. But it is odd behavior.
>>
>> #include was already in my includes.
>
> Then g_remove must be a macro for a function in glib/gstdio.h, not stdio.h.

g_remove() is a macro on Unices and a function on other platforms (or if
G_STDIO_NO_WRAP_ON_UNIX is defined) that is defined in glib/gstdio.h.
There's nothing odd or strange behind this, apart perhaps that you need
to include but the docs tells you.

And glib/gstdio.h includes all the needed stuff (apart perhaps fcntl.h
-- for open() and creat() -- and utime.h -- for utime() --, but these
have nothing to do with g_rename()). So James Morris' answer was the
one: there was simply a missing include.

Regards,
Colomban
_______________________________________________
___________________________________________________

Posted on the Gtk-app-devel-list mailing list. Go to mail.gnome.org/mailman/listinfo/guppi-list/..//gtk-app-devel-list to subscribe.

  #10  
19-02-2011 12:21 AM
Gtk-app-devel-list member admin is online now
User
 

C99 has no implicit int ****, so don't ignore compiler's warning and
fix it.

David Nečas: "All according to the C standard". Right, you didn't tell
us which one, one could think you mean "every C standard out there". C99
is old enough to be supported by decent compilers, older standards
aren't worth mentioning or using.

On 02/17/2011 06:56 PM, David Nečas wrote:
> On Thu, Feb 17, 2011 at 12:45:36PM -0500, Craig Bakalian wrote:
>> I have gtk and glib as includes? Am I missing something?
>
> Yes, on Unix the g_-wrappers are often just macros resolving to the
> underlying system function. So you need to
>
> #include
>
> to get the real declarations (dunno why it's not done automatically in
> this case).
>
>> If there
>> wasn't the right include, the build would fail, further, the function
>> wouldn't remove the file.
>
> On the contrary, unless you pass -Werror=implicit-function-declaration
> or an equivalent of that to the compiler the missing declaration just
> causes a warning. The compiler then implicitly constructs the prototype
> as `takes whatever argument you happen to pass to it and returns int'
> which is sufficiently right here and the program works fine. All
> according to the C standard.
>
> Regards,
>
> Yeti
>
> _______________________________________________
___________________________________________________

Posted on the Gtk-app-devel-list mailing list. Go to mail.gnome.org/mailman/listinfo/guppi-list/..//gtk-app-devel-list to subscribe.





NewsArc Lists  |  Culture Pages   |  Computing Archive  |  Media-Pages
Link to this page on your blog or website by copying the HTML code below and pasting it into your site: