POV-Ray : Newsgroups : povray.off-topic : My first C++ program : Re: My first C++ program Server Time
30 Sep 2024 21:33:33 EDT (-0400)
  Re: My first C++ program  
From: Vincent Le Chevalier
Date: 19 Sep 2008 16:31:10
Message: <48d40c0e@news.povray.org>
Orchid XP v8 a écrit :
> Mueen Nawaz wrote:
>> Orchid XP v8 wrote:
>>> Spot the mistake:
>>
>>     Function lacks a return statement.
> 
> Yup. A simple and obvious mistake. But unfortunately, not one the 
> compiler warned me about. (I'm also curios to know exactly what the hell 
> the function is returning... No doubt the reason there's no compiler 
> warning is that this is actually a valid thing to do due to some bizare 
> C language rule kept for compatibility or something random like that.)
> 
If you are using g++, you can add the option -Wall to your command line. 
The compiler should give a warning in this case... Well two actually, 
one because the variable x is not used for anything and one because the 
function does not return.

I'm leaving the explanation of why this is still legal to someone more 
competent :-)

-- 
Vincent


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.