|
C++ Comments |
|
VincceH (14:32 1/7/2007) Phlamethrower (14:43 1/7/2007) VincceH (16:37 1/7/2007) adamr (15:13 2/7/2007) VincceH (18:51 2/7/2007) Phlamethrower (19:00 2/7/2007) VincceH (22:26 2/7/2007) VincceH (15:05 26/8/2007) VincceH (09:43 27/8/2007) VincceH (10:23 27/8/2007) Phlamethrower (10:37 1/9/2007) Phlamethrower (10:54 1/9/2007) rich (16:25 3/9/2007) VincceH (19:16 3/9/2007) SimonC (19:35 5/9/2007) VincceH (21:33 5/9/2007) VincceH (11:24 16/9/2007) VincceH (23:17 27/10/2007) VincceH (20:25 4/11/2007)
|
|
VinceH |
Message #103230, posted by VincceH at 14:32, 1/7/2007 |
Lowering the tone since the dawn of time
Posts: 1600
|
I don't do C++
I've just discovered that the whole of my source code for WaitUntil is commented out with // (double slash) at the start of each line - which, I believe, is C++ style commenting?
WTF? |
|
[ Log in to reply ] |
|
Jeffrey Lee |
Message #103231, posted by Phlamethrower at 14:43, 1/7/2007, in reply to message #103230 |
Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff
Posts: 15100
|
http://docs.freebsd.org/info/gcc/gcc.info.C++_Comments.html |
|
[ Log in to reply ] |
|
VinceH |
Message #103234, posted by VincceH at 16:37, 1/7/2007, in reply to message #103231 |
Lowering the tone since the dawn of time
Posts: 1600
|
I suspected as much.
What baffles me is how it happened, because when I comment code, I use bog standard /* C comments */
My best guess is that I did it one drunk night. Probably had some daft idea or other, commented out the code in a style I don't use, and then did nothing else.
Which in theory means I can just get rid of the //s and it should then be the same as the last compiled version - but TBH, I should probably go over the whole code with a fine toothcomb, just in case. |
|
[ Log in to reply ] |
|
Adam |
Message #103254, posted by adamr at 15:13, 2/7/2007, in reply to message #103231 |
Member
Posts: 112
|
It's not a C++ thing any more. // style comments are part of the C99 standard.
Adam |
|
[ Log in to reply ] |
|
VinceH |
Message #103261, posted by VincceH at 18:51, 2/7/2007, in reply to message #103254 |
Lowering the tone since the dawn of time
Posts: 1600
|
Point. Missing. The.
I don't care two felt tip pens and a ginger biscuit whether // comments are a part of the C99 standard* - I was making the point that I do not use this style of commenting and yet, presumably when drunk, I have used this style of commenting to comment out the entirety of one of my pieces of software.
Every line of code.
Commented out. This baffles me.
Using a commenting style that I don't use. This baffles me more.
I'm baffled.
And just to clarify that last point: I hereby declare that in the matter of my commented out code, I currently have a mental state of the form commonly known as 'baffled'
However:
* having before your reply discovered that my compiler is happy with that style of commenting (if I'd looked when I bought the Castle version, I'd have found it actually mentioned in the docs), so I'm happy to adopt it from now on because it looks to my eye tidier than /* wibble */ - but that still doesn't explain why I did it in the first place. And I want to know. Now. TELL ME WHY I DID IT! |
|
[ Log in to reply ] |
|
Jeffrey Lee |
Message #103263, posted by Phlamethrower at 19:00, 2/7/2007, in reply to message #103261 |
Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff
Posts: 15100
|
Now. TELL ME WHY I DID IT! Are you sure it wasn't some StrongEd/Zap macro that magically did it for you when you drunkenly selected some text and randomly pressed keys? |
|
[ Log in to reply ] |
|
VinceH |
Message #103272, posted by VincceH at 22:26, 2/7/2007, in reply to message #103263 |
Lowering the tone since the dawn of time
Posts: 1600
|
Like, accidentally select everything, and hit // on the first line. (In StrongEd, obviously, because I don't use that other one).
That's possible, actually* - though it's still curious why it happened to be // * Especially if I'd been using something else on another platform earlier the same day whose default colours happened to match my selected colours in StrongEd's C mode, which is entirely possible. With a bit of alcohol, I might not have clicked that everything was selected. |
|
[ Log in to reply ] |
|
VinceH |
Message #104136, posted by VincceH at 15:05, 26/8/2007, in reply to message #103272 |
Lowering the tone since the dawn of time
Posts: 1600
|
Wow
I've found some more // commenting that proves I used it when sloshed. This time it's been used for actual comments - and clearly typed with the assistance of alcohol.
The file concerned is a sort of scratchpad source file; where I write new stuff for whatever else I'm working on without it 'contaminating' the real source code.
What I've done at some point is start working on a PITA group of functions I need to write - and it's been something that has caused me lots of headaches. I've outlined an approach several times, written some of the functions, aborted the approach and deleted it several times then started again...
But judging by the typing it seems my last attempt didn't get any further than comments outlining an approach, and is finished with the comment:
the basci idea aa oultine abpve is incrediblY so=simple = so much sipler than mt prevoius approachws that i can;t help bit wonder whay ive fogrotten1 (Yes, it's no wonder I don't remember doing it!)
But decyphering that, and the comments outlining the approach I can only conclude that I should DRINK MORE! The comment is bang on; I'd been tearing my hair out over this particular task, and I've been over-thinking it. My drunk solution actually appears to be just the job.
Well, I do have to actually write the functions as outlined, but I think it'll come together nicely. |
|
[ Log in to reply ] |
|
VinceH |
Message #104147, posted by VincceH at 09:43, 27/8/2007, in reply to message #104136 |
Lowering the tone since the dawn of time
Posts: 1600
|
Well, I do have to actually write the functions as outlined, but I think it'll come together nicely. By the end of yesterday, I'd written a good chunk of it. It didn't take long to do it the way I'd outlined. Great. Super. Fantastic. You can't beat a bit of Bully, and all that.
EXCEPT THIS MORNING I CAN'T FIND THE FILE
|
|
[ Log in to reply ] |
|
VinceH |
Message #104149, posted by VincceH at 10:23, 27/8/2007, in reply to message #104147 |
Lowering the tone since the dawn of time
Posts: 1600
|
I found Finder by Chris Nelson and tried that - looked for files datestamped in the last couple of days.
It didn't find it.
I must have somehow completely failed to save the file. The original, with the drunken notes, isn't where I found it - I can only think I moved it after finding it (or possibly deleted it, intending to save the newly written stuff somewhere else).
My excuse is that everything I did yesterday was done after going to bed at 6am the night before and getting up around 8:30 - and in particular, having found that file, I didn't actually write any code based on those notes until yesterday evening. So by then I was 'a bit tired.'
I can broadly remember what I'd decyphered the notes as, so at least that's something... better get them written again and saved pronto!
Ho hum. |
|
[ Log in to reply ] |
|
Jeffrey Lee |
Message #104208, posted by Phlamethrower at 10:37, 1/9/2007, in reply to message #104149 |
Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff
Posts: 15100
|
In similar "argh!" news, I seem to have lost the list of music I was planning on using in DeathDawn.
Argh!
*starts looking in more obscure places* |
|
[ Log in to reply ] |
|
Jeffrey Lee |
Message #104209, posted by Phlamethrower at 10:54, 1/9/2007, in reply to message #104208 |
Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff
Posts: 15100
|
Found it. Phew!
*makes 10 billion copies so he doesn't lose it again* |
|
[ Log in to reply ] |
|
Richard Goodwin |
Message #104233, posted by rich at 16:25, 3/9/2007, in reply to message #104149 |
Dictator for life
Posts: 6828
|
Thank goodness you copied your comments to this forum, otherwise everything would be lost! ________ Cheers, Rich.
|
|
[ Log in to reply ] |
|
VinceH |
Message #104245, posted by VincceH at 19:16, 3/9/2007, in reply to message #104233 |
Lowering the tone since the dawn of time
Posts: 1600
|
External backups always make sense |
|
[ Log in to reply ] |
|
Simon Challands |
Message #104293, posted by SimonC at 19:35, 5/9/2007, in reply to message #104149 |
Right on, Commander!
Posts: 398
|
This sounds rather like you were typing gibberish when drunk, but still managed to get it to compile, by the method of commenting out the gibberish. |
|
[ Log in to reply ] |
|
VinceH |
Message #104295, posted by VincceH at 21:33, 5/9/2007, in reply to message #104293 |
Lowering the tone since the dawn of time
Posts: 1600
|
I can see how it might read that way if you haven't understood what I said.
The "gibberish" I wrote when drunk was commented out at the time I wrote it, not afterwards to make what was left compile. It was written in comment form, because none of it was actually C. It was a step by step guide to what I needed to write, at some arbitrary later point, in C.
Like (though not in gibberish):
// 1. Find the size of the file, allocate the memory and load it // 2. Call such-and-such library function to work out something or other // 3. Calculate some arbitrary thing based on the results of the above to do the below // 4. Do something else // 5. Check something or other // 6. And so on
(Numbered above, but in fact I only numbered some of the steps at the time)
It wasn't so badly written in drunken gibberish that I couldn't read it, and what I read was the ideal solution to a problem I'd be cursing at for ages.
Hopefully, that's a clearer explanation of what I did.
One of the things that amused me, though, was that despite all the silly drunken typos and mis-spellings, not once did I miskey the // at the start of each line. I'm wondering if that's why I used
// comment, rather than...
/* comment */
The latter would be considerably harder to do when the fingers are fueled by alcohol. (Two different keys, one of them needing to be <shift>ed.) |
|
[ Log in to reply ] |
|
VinceH |
Message #104442, posted by VincceH at 11:24, 16/9/2007, in reply to message #104149 |
Lowering the tone since the dawn of time
Posts: 1600
|
[Having accidentally deleted the C I'd written as a result of my drunken notes...]
I can broadly remember what I'd decyphered the notes as, so at least that's something... better get them written again and saved pronto! And this weekend I've found the time to look at it again and actually write some C based on those notes - to the extent that something which has had me stumped for so very long is now written and working, and (subject to some minor tweaking and so on) can be added to the library I'm using for WebChange.
Although finding the time to work on it is still an issue, I think this does actually mean it's downhill from here. |
|
[ Log in to reply ] |
|
VinceH |
Message #104995, posted by VincceH at 23:17, 27/10/2007, in reply to message #104442 |
Lowering the tone since the dawn of time
Posts: 1600
|
And the latest entry in this thread which really isn't a blog, oh no...
I've been putting together an app which would use my search routines - and last night added the magic code to call those routines.
It crashed after a couple of times through the loop. with varying errors (malloc failed, nsfth, another I've forgotten...)
Having spent ages going through it with a fine tooth comb, I completely failed to find the bug - the only thing I managed to do was confirm that it was definitely in the search functions somewhere! So today, I spent even more ages completely rewriting my lovely shiny search routines (most of them, so far, anyway), function by function, line by line, with the old on one half of the screen and the new (based on it) on the other, and giving each function a rigorous test as I went.
Just before starting this post I kicked myself. I'm three functions from the end, and I've spotted the error. A calloc with a size of 0 instead of 1. 1
Quick change, recompile with that change, test, test and test again, and the bug is gone.
So I could delete the meticulously rewritten functions and go back to the originals - but the problem is, my rewritten functions are even shinier than the previous ones. They're lovely. They're neat. It would be a crime against programing to bin them.
So I think I'll continue with that in the morning, and rewrite the last few functions, and drop the result into my library in place of the old ones - where it will put the rest of the library to shame where it's so shiny...
1. Which on the bright side shows that my reasons for writing this app are sound - chiefly, that it allows me to more quickly and easily test changes to the search stuff. If I hadn't gone down this route, it would have been while working on WebChange itself that I encountered the bug - and that would have meant a hell of a larger job tracking it down. |
|
[ Log in to reply ] |
|
VinceH |
Message #105115, posted by VincceH at 20:25, 4/11/2007, in reply to message #104995 |
Lowering the tone since the dawn of time
Posts: 1600
|
So I think I'll continue with that in the morning, and rewrite the last few functions, and drop the result into my library in place of the old ones - where it will put the rest of the library to shame where it's so shiny... Well, due to various things, that morning last week became today... but with that finished, I set about SeeknLink and, after various silly mistakes and mysterious crashes (until the silly mistakes were identified), I now have a (seemingly!) stable version up and running.
It's not ready for release yet* - I want to add at least one new wildcard type to the search code, and there are some options I want to add - but it's working, and proving my search code, so that's good.
Interesting Factoid: In previous versions of WebChange, the wildcards were limited in that you couldn't have one at the start or end of the search term. Now, it's possible - to the extent that the search term can be nothing more than a single wildcard. So now, you can wipe out the contents of all your html files using one simple search and replace. Yay for progress!
* Plus, I don't have a website online at www.softrock.co.uk yet, having moved it. I want to finish the re-design I started oh-so-many months ago, which I'll work on this week, hopefully. |
|
[ Log in to reply ] |
|
|