Very strange problem/bug

Here is a simple code:

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glOrtho(0, 800, 0, 480, -1, 1);
glRasterPos(0,0,0);

glBegin(GL_LINES);
glVertex2i(10, 10);
glVertex2i(100, 10);
glEnd();

These coordinates should be equivalent to screen ones and the line should be a simple horizontal from x=10 to x=100 screen coord. Unfortunately from time to time the line is drawn to x=99 or x=101, depending on the y position (!!!). Any idea, please ??

glOrtho should be called so as to affect the projection matrix, not the modelview.
glRasterPos has nothing to do with vertex-driven rendering. It is used in the pixel path.

As far as your problem goes, the center of pixels have a 0.5,0.5 offset. What you see is probably post-transform rounding errors. Try to specify vertices with floats:
glVertex2f(10.5f, 10.5f);
glVertex2f(100.5f, 10.5f);