Browser Warnings

This is a discussion on Browser Warnings within the C++ Programming forums, part of the General Programming Boards category; I have a bunch of browser warnings and I am not sure if I should ignore them or if they ...

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,434
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21