Thread: Browser Warnings

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    45

    Browser Warnings

    I have a bunch of browser warnings and I am not sure if I should ignore them or if they actually are warning about improper logic, take a look...

    Code:
    vector <int> tlist;
    for(int i = 0; i < tlist.size(); i++)
    yields...

    warning C4018: '<' :signed/unsigned mismatch

    Code:
    vector<Truck> t;
    int pastdue = (t[i].getMilesTillS()).find("Due");
    yields...

    warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data

    Code:
    string stringtext;
    int length = stringtext.length();
    yields...

    warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    So pay attention to the types, and make those things size_t instead of int.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Banned
    Join Date
    Jun 2005
    Posts
    594
    typicalyl you should treat warnings as errors, and try to correct
    them, i hae a bad habit about using int for size_t to.


    if you choose to use int over size_t when the the data type
    calls for size_t, you run the risk of the int not being able
    to hold all the possible returns to the variable of type
    int and should be size_t.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Internet Browser Handling
    By pobri19 in forum Windows Programming
    Replies: 9
    Last Post: 04-04-2009, 06:19 AM
  2. Getting Default Browser and Running It
    By Driver in forum Windows Programming
    Replies: 4
    Last Post: 10-22-2004, 02:08 PM
  3. Replies: 4
    Last Post: 05-28-2002, 06:19 PM
  4. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 06:49 PM