Author Topic: Programming question  (Read 4790 times)

Offline BrianOlsen

  • Junior Phone Loser
  • **
  • Posts: 23
  • 1337 13V3L: +0/-0
Programming question
« on: May 01, 2007, 10:49:14 PM »
I'm wanting to use comments to explain a particular line of code and my editor is not reflecting it correctly.  Here's my comments

Code: [Select]
/+ a=b;
/+ c=d; +/
    e=a+c; +/

any help would be appreciated.

Offline Reverend Greed

  • PLA Guru
  • *****
  • Posts: 224
  • 1337 13V3L: +42/-7
Re: Programming question
« Reply #1 on: May 01, 2007, 10:53:54 PM »
I'm wanting to use comments to explain a particular line of code and my editor is not reflecting it correctly.  Here's my comments

Code: [Select]
/+ a=b;
/+ c=d; +/
    e=a+c; +/

any help would be appreciated.

Why is that a big deal?  Besides, you're nesting your comments.
Reboot America

Offline BrianOlsen

  • Junior Phone Loser
  • **
  • Posts: 23
  • 1337 13V3L: +0/-0
Re: Programming question
« Reply #2 on: May 01, 2007, 10:56:49 PM »
Because they are needed when I want to comment out a block of code which already contains comments.

Offline Reverend Greed

  • PLA Guru
  • *****
  • Posts: 224
  • 1337 13V3L: +42/-7
Re: Programming question
« Reply #3 on: May 01, 2007, 11:05:36 PM »
Then why not simply do this?

Code: [Select]
/+ a=b;
    c=d;
    e=a+c; +/
Or this:

Code: [Select]
/+ a=b; +/
/+ c=d; +/
/+ e=a+c; +/

It'll sure save the hassle of what your editor is doing.
Reboot America

Offline BrianOlsen

  • Junior Phone Loser
  • **
  • Posts: 23
  • 1337 13V3L: +0/-0
Re: Programming question
« Reply #4 on: May 01, 2007, 11:11:22 PM »
I understand that, but dealing with embedded devices - like I do all day - C is still the programming language of choice. And C knows only this /* */ comment style. // has been introduced with C++. Nevertheless most compilers nowadays support // inside a C file. And as far as I remember it's part of the newer C99 standard. But usually the old C90 standard is used.

But as you know by my /+ that I'm using D.  And D contains all three comment-outs.

Offline Reverend Greed

  • PLA Guru
  • *****
  • Posts: 224
  • 1337 13V3L: +42/-7
Re: Programming question
« Reply #5 on: May 01, 2007, 11:18:05 PM »
Okay,

Lets use your example with C/C++ comment styles.  According to your beginning post you basically wanted to do this:  /* /* */ */.  To me, this is pointless.  The /* */ comment is designed for debugging.  Normal comments should be made with the //.

If you comment out a block with the /* */ and want to comment out a bigger block, don't add more of them, just move the ones you have.  If the language doesn't have 2 kinds of comments, they typically only have the single line comment like REM.  If you write formatted easy to follow code, you really shouldn't have any block /* */ comments in your finished code anyway, so you'd only need that if you write ugly programs in a straight line and actually want to comment them.  Chances are if you purposely write ugly code, you don't want any comments.  If you write a nested block comment, the program should reach out and smack you.
Reboot America

Offline BrianOlsen

  • Junior Phone Loser
  • **
  • Posts: 23
  • 1337 13V3L: +0/-0
Re: Programming question
« Reply #6 on: May 02, 2007, 01:11:23 AM »
I see what you're saying.  Agree to disagree maybe?  I'm going to test it while debugging.  Also, I don't have a C compiler handy so I'll try tomorrow.

Offline BrianOlsen

  • Junior Phone Loser
  • **
  • Posts: 23
  • 1337 13V3L: +0/-0
Re: Programming question
« Reply #7 on: June 04, 2007, 05:38:00 AM »
Sorry for not getting back to you.  I ended up using the nested comments and just dealt with the fact that my editor did not highlight appropriately.

---------------------------------------------------------------------------

To change the subject what languages due you use to develop web apps?

Offline Reverend Greed

  • PLA Guru
  • *****
  • Posts: 224
  • 1337 13V3L: +42/-7
Re: Programming question
« Reply #8 on: June 04, 2007, 08:24:12 AM »
I use XUL, JavaScript, HTML, and CSS.
Reboot America

Offline mr_doc

  • Supergluer of coins
  • PLA Junkie
  • *****
  • Posts: 801
  • 1337 13V3L: +71/-24
    • PLA LotGD
Re: Programming question
« Reply #9 on: June 04, 2007, 02:51:34 PM »
I'm wanting to use comments to explain a particular line of code and my editor is not reflecting it correctly.  Here's my comments

Code: [Select]
/+ a=b;
/+ c=d; +/
    e=a+c; +/

any help would be appreciated.

That would comment out
a=b;
/+ c=d;
and leave you with
e=a+c; +/ uncommented

Rev. Greed is right. Delete the nested start and end comment tags and you will accomplish what you wanted.

PLAlotgd  -If you play, I will hate you a little less.
Unnamed Forums

Offline BrianOlsen

  • Junior Phone Loser
  • **
  • Posts: 23
  • 1337 13V3L: +0/-0
Re: Programming question
« Reply #10 on: June 14, 2007, 09:21:21 PM »
I'm wanting to use comments to explain a particular line of code and my editor is not reflecting it correctly.  Here's my comments

Code: [Select]
/+ a=b;
/+ c=d; +/
    e=a+c; +/

any help would be appreciated.

That would comment out
a=b;
/+ c=d;
and leave you with
e=a+c; +/ uncommented

Rev. Greed is right. Delete the nested start and end comment tags and you will accomplish what you wanted.



Yeah, he was right. I fixed it.

Offline BrianOlsen

  • Junior Phone Loser
  • **
  • Posts: 23
  • 1337 13V3L: +0/-0
Re: Programming question
« Reply #11 on: June 14, 2007, 09:27:35 PM »
Rev, you helped me out with SSI before...

I have a dynamic javascript controlled iframe that handles resizing of the iframe. I need to work that into the SSI.php file so that it calls the javascript function & loads whatever link fro SSI into the iframe.

The syntax that I would normally use to open a static link would be: href="javascript:loadintoIframe('mainframe', 'yabbse/index.php')"

I tried href="javascript:loadintoIframe('mainframe', ', $post['href'], ')" with various quote & comma options with no luck..

Offline Reverend Greed

  • PLA Guru
  • *****
  • Posts: 224
  • 1337 13V3L: +42/-7
Re: Programming question
« Reply #12 on: June 14, 2007, 09:42:32 PM »
Try this:

Change:

Code: [Select]
href="javascript:loadintoIframe('mainframe', ', $post['href'], ')"
To this:

Code: [Select]
<a href="javascript:loadintoIframe(\'mainframe\', \'', $post['href'], '\')">
Reboot America

Offline BrianOlsen

  • Junior Phone Loser
  • **
  • Posts: 23
  • 1337 13V3L: +0/-0
Re: Programming question
« Reply #13 on: June 14, 2007, 09:53:58 PM »
Damn, man.  That was it.  Did you go to school to learn this or what?  How about I just send you all my stuff for you to finish.

Offline Reverend Greed

  • PLA Guru
  • *****
  • Posts: 224
  • 1337 13V3L: +42/-7
Re: Programming question
« Reply #14 on: June 14, 2007, 10:08:24 PM »
Actually, I obtained a Bachelor's in Business Administration with a Marketing option.  I minored in Computer Science though. 

I self taught myself the vast majority of computer related activities.  The game, Oregon Trail, back in the early 80's was what got me fascinated with computers.  I was able to obtain the source code of that game and studied it like no other.

All in all, I wasn't about to spend thousands of dollars to major in Computer Science when I already knew the entire curriculum.
Reboot America