|
Lee Humphries wrote: your breakfast decides it's going to post a return to the function call,
OK I have to admit this awakened me from my post-launch Sleep(600000) session.
Alberto Bar-Noy
Project Manager
http://www.consist.co.il
|
|
|
|
|
Your nick name length is making horror to CP
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
Yes in hind sight, i guess it was not a very good decision i changed it to something more professional
|
|
|
|
|
Sadly here in sunny Australia we don't (generally) get medical benefits etc... so no, I was nowhere near getting what he was on... never mind, I make more now to make up for it!!
-------------------------------------------
Damian - Insert snappy one-liner here.
|
|
|
|
|
Wow that was some real newbie mistake ! But what does that say about the organization that implemented his code without verification ?
Je vous salue du Québec !
|
|
|
|
|
It is always a golden rule to take anything outside the loop.
|
|
|
|
|
That why i like C++, it is faster.
Greetings from Germany
|
|
|
|
|
dude that funny.. you must go for contractor job then
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief
|
|
|
|
|
It's not too horrible, but while perusing an article I noticed this method of inserting quotes into a @-quoted string literal (text disguised to protect the guilty):
string x = @"Blah blah blah " + Convert.ToChar(34).ToString() + @" etc. " ;
I don't know why the author used @-quoted string literals in this case anyway.
-- modified at 16:27 Monday 18th June, 2007
|
|
|
|
|
@-quoted literals are useful for two reasons: 1) when dealing with strings that contain backslashes; 2) when dealing with strings that contain CRLF characters. We've used them in scenario 2 for complicated queries to SQL Server CE, which does not support any form of stored program. Heck, a CREATE TABLE statement rapidly runs off the end of even the largest sensible screen width. You waste a few bytes of your program space on unnecessary spaces and tabs required to keep it all in line, but you don't keep having to concatenate.
Generally strings containing backslashes are file paths. Double-quote characters aren't valid in file paths. They're valid in SQL but only for delimiting identifiers, and the square brackets [] do the same job whether or not the quoted_identifier option is on.
The proper way to insert double-quotes into an @-quoted string literal in C# is of course just to double them up.
|
|
|
|
|
Exactly, but the author didn't use the @-quoted string literal to do any of those things; no special characters, and still broke the string into parts and concatenated the parts.
I use them for SQL statements and scripts. They can also be useful with regular expressions.
But if you're going to use them, use them.
|
|
|
|
|
I remember reading somewhere that .NET compilers optimize static string concatenation. But maybe I'm wrong.
If you truly believe you need to pick a mobile phone that "says something" about your personality, don't bother. You don't have a personality. A mental illness, maybe - but not a personality. - Charlie Brooker
My Blog - My Photos - ScrewTurn Wiki
|
|
|
|
|
But this is not a static string concatenation because Convert.ToChar(34).ToString() isn't a constant, but a method call.
Only string concatenations that don't cause a compile error in const declarations are optimized by the compiler.
E.g.
const string name = "Bob";
const string test = "Hello " + name; // valid, concatenation happens at compile time
const string test2 = "Hello" + Convert.ToChar(32).ToString() + "Bob"; // invalid
|
|
|
|
|
|
He most probably didn't understand what he was doing, that's sad.
Je vous salue du Québec !
|
|
|
|
|
Placing an "@" does not produce any error for line break.
e.g. the following code would produce an error.
string x = "Blah blah blah"
+ Convert.Tochar(37) .ToString();
But the following would not
string x = @"Blah blah blah"
+ Convert.Tochar(37) .ToString();
(I am writing this without testing. So feel free to let me know if I am wrong.)
|
|
|
|
|
as an assignment, i asked for a program that we've all been through, a function that returns weather or not a given number is prime.
in one case, i was given the following :
if(num== 1 || num== 2 || num== 3 || num== 5 || num== 7 || num== 11 || num== 13 || num== 17 || num== 19 || num== 23 || num== 29 || num== 31 || num== 37 || num== 41 || num== 43 || num== 47 || num== 53 || num== 59 || num== 61 || num== 67 || num== 71 || num== 73 || num== 79 || num== 83 || num== 89 || num== 97 || num== 101 || num== 103 || num== 107 || num== 109 || num== 113)
{
return true;
}
else
{
return false;
}
when i asked him why he stopped at 113
(since it was the only thing i thought of asking) he said, in a tired voice,
"I couldn't think of any more numbers"
do you, or do you not feel sorry for him?
|
|
|
|
|
|
well then.
and i felt sorry for him having to find them on his own.
well observed!
|
|
|
|
|
- Pascal - wrote: wikipedia stops at 113 too
13 is considered bad unlucky number. Is 113 fall under this category also?
|
|
|
|
|
Interesting how many unproved conjectures there are.
Kevin
|
|
|
|
|
That would be one heck of a long list if they (the original coder or Wikipedia) attempted listing all the primes
Rob G
|
|
|
|
|
And, in addition to being very limited in the range of input values, the result isn't correct, either.
<SmartassMode>
1 is not a prime number, by definition.
</SmartassMode>
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
True, but that did not worry me.
|
|
|
|
|
mav.northwind wrote: 1 is not a prime number, by definition.
It is qualified as Unique Number right?
|
|
|
|