There are so many factors that come into play here such as the age, size, construction, safety and and construction. It has to be looked at on a case by case basis. Was this porch there from when the house was first built? If so it is most likely legal. You should be able to see this on the originaI plans. Also, I believe there is a loophole stating that if it is a temporary structure that it is ok. Often times this would be the case with a screened porch.
Most people hire an architect, lawyer or expeditor to research the legality. As I said, you can look at the original plans if they are available and do research online or at the Department of Buildings in person. Is there an old survey? Any documentation you have will help. Often times there is a gray area where it can be argued that the structure is legal.
Depending on the age of the house you can check out documents like the survey and certificate of occupancy. Also, if the house was built before 1938 (this is the year that the certificate of occupancy laws went into effect), you can refer to the "Sandborn" maps to see if the enclosed porch was there back then. These are aeriel maps of Brooklyn taken back in the 1920's (or there abouts) which show every house in Brooklyn at the time. If the enclosed porch is on the Sandborn maps, I do not think anyone would be at issue with it's legality.
Please keep in mind that I am not an attorney and I cannot give out legal advice. The information above is deemed accurate and reliable but not 100% guaranteed as such matters differ case to case. You can Google this stuff. Do more research to make sure you get the correct answers for your case. Good luck, if I can be of further assistance, please let me know.
Mitchell S. Feldman
Associate Broker/ Director of Sales
Madison Estates & Properties, Inc.
Office: (718) 645-1665/ Cell: (917) 805-0783