Thread: micrososoft foundation class quick question

  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    144

    micrososoft foundation class quick question

    Why don't I get an error here? There is no where in the code I initialise the buffer array. Should there not be an error on LINE 22?

    Code:
    double point[6][3]; 
    	double buffer[6][3];
    
    	//p1
    	point[0][0] = 300;  point[0][1] = 50;  point[0][2] = 0;
    	//p2
    	point[1][0] = 150; point[1][1] = 50; point[1][2] = 0;
    	//p3
    	point[2][0] = 260;  point[2][1] = 150; point[2][2] = 0;
    	//p4
    	point[3][0] = 250; point[3][1] = 200; point[3][2] = 0;
    	//p5
    	point[4][0] = 160; point[4][1] = 300; point[4][2] = 0;
    	//p6
    	point[5][0] = 300; point[5][1] = 300; point[5][2] = 0;
    
    ...
    
    
    for (int j=1;j<5;j++)
    		{
    			pDC->MoveTo(buffer[j][0], buffer[j][1]);
    			pDC->LineTo(point[j][0], point[j][1]);
    			buffer[j][0] = point[j][0]; 
    			buffer[j][1] = point[j][1];
    		}
    Last edited by bos1234; 05-16-2012 at 12:25 AM.

  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
    What error were you expecting?

    If you turn up the warning level on the compiler, you might get a "use before initialisation" message.
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Quick question - class declaration
    By officedog in forum C++ Programming
    Replies: 4
    Last Post: 12-12-2008, 01:52 PM
  2. Quick class question
    By Stonehambey in forum C++ Programming
    Replies: 2
    Last Post: 04-13-2008, 10:12 AM
  3. Quick question about class template
    By merixa in forum C++ Programming
    Replies: 5
    Last Post: 12-06-2005, 11:43 PM
  4. Quick Class Question (say that 3 times)
    By GrNxxDaY in forum C++ Programming
    Replies: 2
    Last Post: 07-25-2002, 11:16 AM
  5. Quick struct/class question
    By GrNxxDaY in forum C++ Programming
    Replies: 10
    Last Post: 07-23-2002, 06:15 PM