I have always wondered about this, especially in C/Java style languages. For example, consider the first 3 lines of this C# code:
lock (serviceLock)
using (var client = new ServiceClient())
try
{
// Do something
client.DoSomething();
}
catch (System.ServiceModel.FaultException ex)
{
// Handle error
addLog(ex.ToString());
}
This usage has always seemed somewhat questionable to me. However, the alternative is not very practical either (3+ levels deep of indentation for a service call). Apart from pure aesthetics, is there any practical reason to add or not to add the extra brackets in this case?