Don't tell me how to declare a string!
-
TClarke wrote:
private static final String SQL = "" + " SELECT " + " nvl( vss.structure_address, " + " ifsapp.serial_structure_template_api.get_pos(top_part_no," etc...
Without the "" on the first line, you couldn't start the second line with a + hence the indentation might be at risk, i.e. the third and following lines might not align with the second one; this may become very important when the code is worthwhile and is likely be published on one or more forums. BTW: the code itself is OK, the compiler does the concatenation for you.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
Indentation-wise, I find that this works well: string query = "SELECT [foo], [bar] " + "FROM [f] " + "WHERE [id] = @id";
-
Indentation-wise, I find that this works well: string query = "SELECT [foo], [bar] " + "FROM [f] " + "WHERE [id] = @id";
That's fine by me, the only risk is you might omit a space somewhere, which you would notice more easily if everything were on one line.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
-
compilers don't have feelings. they cannot be horrified. ;)
image processing toolkits | batch image processing | blogging
-
Compilers are smart enough to understand that the concatenation of two literals yields a bigger literal. They don't generate run-time code to get that done. Also -- not applicable in this case -- the CLR compilers are known to use a StringBuilder if your code is performing complex concatenation involving not just literals, even when the source does not call for a StringBuilder explicitly. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
Oh nice! I didn't know that… Now I can write sloppy string concatenation code without worrying about the performance penalty! ^_^ Does this feature count as encouraging bad coding practices?
ROFLOLMFAO
-
Oh nice! I didn't know that… Now I can write sloppy string concatenation code without worrying about the performance penalty! ^_^ Does this feature count as encouraging bad coding practices?
ROFLOLMFAO
Ri Qen-Sin wrote:
Does this feature count as encouraging bad coding practices?
Most people dont need to be encouraged in the wrong direction. Compiler optimizations typically improve the simple cases, and seldom drastically improve the complex cases (where most could be gained!). So staying vigilent would pay off frequently. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google