Forum > FPC development

[SOLVED] Improvement of TBinaryObjectWriter.WriteIdent

<< < (2/2)


--- Quote from: Josh on June 22, 2023, 10:50:11 am ---for readability curious as to why your removing the comment.

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ----  { Check if Ident is a special identifier before trying to just write-    Ident directly }
--- End quote ---

When I removed it I was thinking that the comment makes sense only in the presence of the if then else series, not in the presence of a case statement. The presence of the case statement would imply the contents of the existing comment because that's how the case statements work.

I find the purpose of the comment is to explain what the following code does; without having to analyze the code to work out what its doing.

The case statement with strings is actually translated by the compiler into if then else.
Also note the introductary notes about this "feature". Any way you see it, case with string introduces an indirection.
There was quite a discussion on the development forum about this too.

Posted to

Stefan Glienke:
Anyone who fancies compiler optimization might want to look into switch lowering - see


[0] Message Index

[*] Previous page

Go to full version