I'd venture a guess that over 95% of the people who use scanf don't actually know how to use it.
Yes
No
I'd venture a guess that over 95% of the people who use scanf don't actually know how to use it.
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
I've used it many times, always just mirror a printf() when I use it, and I'm probably missing something. I tend to prefer c++ and std::cin, but that's mainly because I'm lazy.
abachler: "A great programmer never stops optimizing a piece of code until it consists of nothing but preprocessor directives and comments "
I don't use it because I don't know how to use it correctly...
"The Internet treats censorship as damage and routes around it." - John Gilmore
I'm wondering if this is the place to ask that question. Or if there is any place where you could ask this question at all and get unbiased and fair results.
Well since your question didn't directly indicate the person filling out the poll, I said yes since I'd expect programmers (professional in particular) to know how to use it. I usually use the variants to read data in from a string since I rarely read data from the keyboard using methods that require a carriage return.
I voted yes, but I've a feeling that there's some kind of twist in what you asked. I know how to basically use it, I would have to look up some of the letters to follow the % signs for different types of variables, but on face value, I believe I do know how to use it.
Why do you think ~5% of people know how to use it?
Twomers:
> I voted yes, but I've a feeling that there's some kind of twist in what you asked. [...]
> I believe I do know how to use it.
Positive thinking!
Dave is generally not a rude person I think, so I doubt he's insulting anyone. If I had to guess though, just recently, someone blindly recommended use of scanf for apparently no reason. And Dave was just so appalled...
>I'd venture a guess that over 95% of the people who use scanf don't actually know how to use it.
That's pretty pessimistic. I'd say that most people who know C also know scanf well enough to use it successfully for basic things. When you get into solid, robust usage and advanced features like scansets and read counts, your guess is probably more accurate. I voted no because I consider the ability to safely use scanf important, and I see it very rarely.
My best code is written with the delete key.