|
Aren't those ASCII 96s, not ASCII 39s? That's what I thought the WTF was.
|
|
|
|
|
I don't get it, what is wrong here (except for the weird quotes)
|
|
|
|
|
Actually, I don’t get it either and I have about 20 years C programming experience.
The code shown would generate errors at compile time – simple to fix.
If the code where typed correctly, then what would bounds have to do with it?
I usually use a pointer to constant string for such strings, but if I wrote it like that I would type:
const char myStr[] = "just testing";
Without seeing the context in which it is used, that’s all I can see.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Well I'm glad that I'm not the only one who can't see it. I wonder if he meant to have an array size in the char[] declaration? The only other thing that I can think is that he is reusing this variable elsewhere, and that's where the error is (i.e. the point where the bounds checking would come into play).
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Programm3r wrote: made this slight error
Where
.net is a box of never ending treasures, every day I get find another gem.
|
|
|
|
|
A possible problem with the code is that the programmer seemed to be sizing the array in a very arbitrary way. Unless of course "This is a test" is the max intended size of the array and the rest of the code isn't going over the array size.
Plus it forces every programmer who looks at the code to start counting on his fingers, getting to 10 and saying, "damn" before starting over because he couldn't remember if he included the space between 'this' and 'is' ;v)
|
|
|
|
|
Did this forum just change it's name again? WTF? The horrorror!
----
It appears that everybody is under the impression that I approve of the documentation. You probably also blame Ken Burns for supporting slavery.
--Raymond Chen on MSDN
|
|
|
|
|
Shog9 wrote: Did this forum just change it's name again?
Yeah... was I disappointed! I thought it was going to be a forum about using code words while talking with prostitutes.
led mike
|
|
|
|
|
|
I don't know - you look away for just a minute and the Kid Sister police swarm all over the place.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Isn't it obvious? The new name describes the content more accurately, but is also more politically correct.
Oh for the days when one could call politician a politician and no one was offended by the name.
Phil
|
|
|
|
|
Yeah. We were getting too many general WTFs. I want specific, code related WTFs.
This wasn't PC motivated. This was RTFM motivated.
cheers,
Chris Maunder
CodeProject.com : C++ MVP
|
|
|
|
|
My mistakes go to "subtle bugs", and all other to "coding horrors"?
|
|
|
|
|
Yep!
cheers,
Chris Maunder
CodeProject.com : C++ MVP
|
|
|
|
|
one of my team mate has written like this in c#
if (Request.QueryString["test1"] != null)
{
--- do something
}
else
{
Response.Redirect(Request.UrlReferrer.ToString(), false);
}
What the --------
-- modified at 6:24 Thursday 29th March, 2007
|
|
|
|
|
Could you please translate this for all the C++ programmers here
Alcohol, the cause of and the solution to all of life's problems - Homer J. Simpson
|
|
|
|
|
if "?test1=..." appears in the URL for this page
{
--- do something
}
else
{
send a request back to the client to get their browser
to re-request this page without the "?test1=..." bit on the end
} That's uuuh-gleeee
cheers,
Chris Maunder
CodeProject.com : C++ MVP
|
|
|
|
|
Actually it sends them back to the page that referred them to the current page (which isn't a good idea because Norton and McAfee like to change your settings so referrer information is not passed with the request).
Request.UrlReferrer
|
|
|
|
|
Hy one of my groub member in a project showed me this:
public static String startPhred(File directoryToEdit) {
try {
String text = "";
BufferedReader in;
if (directoryToEdit == null) {
directoryToEdit = new File("J:/user/daten/950599/");
}
try {
makeScript(directoryToEdit);
} catch (Exception e) {
e.printStackTrace();
}
Process p = Runtime.getRuntime().exec(pfadScriptFile.getAbsolutePath());
in = new BufferedReader(new InputStreamReader(p.getInputStream()));
StringBuffer out = new StringBuffer();
return out.toString();
} catch (IOException e) {
e.printStackTrace();
}
return "EXCEPTION AUFGETRETEN!!";:confused:
}
This was nice
Or the same guy did this:
TraceData is a class that we need in our project.
So he wrote, because he need a collection of this class:
public class TraceDataList{
public List <TraceData> traceDataList = new ArrayList<TraceData>();
}
public List getAb1Files (){
return traceDataList;
}
public void add(TraceData data){
traceDataList.add(data);
}
...and a method with the parameters for traceData, where he
did make a new Object and added it to his list.!!!
}
end of class!!
And yes he programms for about 1 1/2 years in Java!!
|
|
|
|
|
|
The below code was written by two of my team mates in two different projects. Below code in MFC.
...::OnMouseMove(...)
{
CRect rc; GetClientRect(rc);
ClientToScreen(rc);
POINT pt; GetCursorPos(&pt);
if (rc.PtInRect(pt))
{
}
}
What they are tryin is, checking the mouse pointer is over the window in OnMouseMove Handler... What to say?...I think one should Cut and Copy the above logic!!!..
Do your Duty and Don't expect the Result Rate this Post, if I helped You
|
|
|
|
|
Brilliant piece of being sure!!
|
|
|
|
|
Check whether they've used SetCapture anywhere. If the mouse is captured, you will get mouse event messages outside the window's client rectangle. Also, note that GetCursorPos tells you the current position - a WM_MOUSEMOVE message tells you that the mouse moved when captured or when over the window at some point in the past. Perhaps they were trying to filter out old events? This would only be a problem if the application isn't very responsive to window messages, however.
If you want to know the cursor position when the message was generated, that appears in the WM_MOUSEMOVE message's lParam parameter. This is actually relative to the client rectangle already, so ClientToScreen is not required. MFC's OnMouseMove function extracts the lParam message parameter to the point parameter.
Do note however that Windows limits the rate at which it sends WM_MOUSEMOVE messages so that applications aren't overwhelmed, if the application is busy. You used to be able to see this effect in Windows Paint if you moved the mouse very rapidly while drawing - the line would be in lots of straight segments, rather than being smooth - but modern PCs are well up to the demands of Paint, so you don't see it any more.
(Personally I would use ScreenToClient on the cursor's location and then use client rectangle-relative co-ordinates throughout, rather than converting the other way).
|
|
|
|
|
Yeah, that's exactly what I was thinking as I read the code. I wonder what the truth of the matter is....
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: I wonder what the truth of the matter is....
Here the truth...[^]
Do your Duty and Don't expect the Result Rate this Post, if I helped You
|
|
|
|