Well, I happen to be working on a big project and one function tends to be a bit complex. And I get this weird error:
[Warning] ImportExportDataModule.pas(1013): Return value of function 'Limitation' might be undefined
Well, I simplified the whole code to the following:
function Limitation: string;
V00, V01, V02, V03, V04, V05, V06, V07, V08, V09: string;
V10, V11, V12, V13, V14, V15, V16, V17, V18, V19: string;
V20, V21, V22, V23, V24, V25, V26, V27, V28, V29: string;
V30, V31: string;
Result := '';
And yes, I set the return value of this function correctly. And I get about 30 hints about unused variables. But ignore the hints. Focus on the warning! Why does it generate this warning?
Well, a simple count of the number of variables within this function just reveals that I have 32 variables. Plus one for the result, making a total of 33. If I would remove any one of them then my problem is gone! No more warning by just removing one of them...
It makes me feel real sad though to realise that Delphi has such a strange limitation. Makes me wonder why it gives an error and if it has any effects on how the generated code will run. It's one of those things that make me feel real uncomfortable inside...
Oh, well. Done with the ranting. Time for the question... Where does this limit come from, where is it documented and what will happen if I just ignore it? And what happens with procedures that have over 32 variables? Do they have similar limitations too?
But most important question: Can this warning be ignored without ANY risks?