Thread: warning i've never seen

  1. #1
    Registered User linuxdude's Avatar
    Join Date
    Mar 2003
    Location
    Louisiana
    Posts
    926

    warning i've never seen

    Code:
    warning: assignment discards qualifiers from pointer target type
    I got this warning with gtk
    Code:
     - Function: gchar* gtk_entry_get_text (GtkEntry *ENTRY)
         Returns the text that is contained in the `GtkEntry' as a pointer
         to a `gchar' variable.
    here is my code
    Code:
    gchar *input;
    .
    .
    .
    input=gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry));
    what does this mean?
    Thanks

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >warning: assignment discards qualifiers from pointer target type
    What's the type of "GTK_ENTRY(GTK_COMBO(combo)->entry)"? Does it have a const or volatile qualifier?
    My best code is written with the delete key.

  3. #3
    Registered User linuxdude's Avatar
    Join Date
    Mar 2003
    Location
    Louisiana
    Posts
    926
    I don't know what a qualifier is.
    here is
    Code:
    GtkWidget *combo;
    combo=gtk_combo_new();
    I dont' think that helps though. Entry can change so i'd say that's volatile but i'm not about GTK_ENTRY

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >I don't know what a qualifier is.
    const and volatile are qualifiers. They add restrictions or further information to a type.
    My best code is written with the delete key.

  5. #5
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    Entry can change so i'd say that's volatile but i'm not about GTK_ENTRY
    It can be changed, so it is voilatile?
    Where the GtkWidget is defined?[edit] And other stuff.
    Last edited by siavoshkc; 08-30-2006 at 11:16 AM.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  6. #6
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    volatile is a keyword to tell the compiler not to cache the value of the variable between statements because the variable can be changed outside the program, by a different thread for example. It's not used very often.

    You probably know what a const qualifier is: it specifies that the given variable cannot be changed.

    [edit] A GtkWidget is defined as this:
    Code:
    typedef struct {
      /* The style for the widget. The style contains the
       *  colors the widget should be drawn in for each state
       *  along with graphics contexts used to draw with and
       *  the font to use for text.
       */
      GtkStyle *style;
      
      /* The widget's desired size.
       */
      GtkRequisition requisition;
      
      /* The widget's allocated size.
       */
      GtkAllocation allocation;
      
      /* The widget's window or its parent window if it does
       *  not have a window. (Which will be indicated by the
       *  GTK_NO_WINDOW flag being set).
       */
      GdkWindow *window;
      
      /* The widget's parent.
       */
      GtkWidget *parent;
    } GtkWidget;
    From http://developer.gnome.org/doc/API/2...GtkWidget.html [/edit]
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 10
    Last Post: 07-10-2008, 03:45 PM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 01:03 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM