XSpice codemodeling for dummies?

Active8 wrote:

i sometimes look for Kevin/Mike exchanges in the thread view just to
break the monotony :) this one wasn't very good. the flame level
just wasn't there. they're slacking.

but that brings up something i've been thinking of lately.
considering that the PSpice documentation raises more questions than
it answers... that the docs are nearly useless...

i was thinking it may have been easier to just use SS and LTSpice for
sims. you know, generate a netlist from SS where at least the
capture part is a no brainer. at least creating parts should be
easier than it is in LTSpice. drop the netlist in LTSpice and probe
the output in SS.

can you imagine the shit that could get started between those two
when i start hammering them both with questions? :) ^2
Oh, that would be good. That would be very good. Sort of the cyber
equivalent of tossing two cats in a bag, but without the cruelty, since
any damage would be self-inflicted by two humans who, unlike cats, have
choice in the matter.

I like the way you think.

Start selling the tickets.

i've saved as many of helmut's LTSpice answers as i came across, just
in case. he's put out some good help for creating new parts. maybe
Linear should put him on the payroll.
Helmut's stuff is top-notch.

MikeE
 
Active8 wrote:
In article <nerbmv4ore19pip4obbghsi9bmqaevh445@4ax.com>, Jim-T@golana-
will-get-you.com says...


but that brings up something i've been thinking of lately. considering
that the PSpice documentation raises more questions than it answers...
that the docs are nearly useless...

i was thinking it may have been easier to just use SS and LTSpice for
sims. you know, generate a netlist from SS where at least the capture
part is a no brainer. at least creating parts should be easier than it
is in LTSpice. drop the netlist in LTSpice and probe the output in SS.
For referance, you can just drag the SS netlist to LTSpice and run, but
make sure LT has been set to ASCII data file mode. Then use the SS file
menu to load in the/all LTSpice rawfile(s). This then gives you full
schematic x-probing. Obviously, its on the long runs that this is most
useful for.

Note that you have to press the pink "I" button at last once first. This
generates a blank include file that the SS netlist always has an entry
for. Unfortunately, LTSpice exits the sim if it can't find a netlist
declared include file.

LTSpice must have a spice type command line interface, but I have no
idea what it is, so I cant set it up to be transparent. Any other
standard Unix type command line spice can be ran transparently from SS.



Kevin Aylward
salesEXTRACT@anasoft.co.uk
http://www.anasoft.co.uk
SuperSpice, a very affordable Mixed-Mode
Windows Simulator with Schematic Capture,
Waveform Display, FFT's and Filter Design.
 
: Actually it is pretty much a closed club. The number if folks that can
: successfully create a useful model for ANY spice is very few. You can't
: do it unless you understand both spice, and the underlying physics of
: the device very well. You can tweek some "Beethoven's" model here and
: there and *perhaps* get a useful result, but to successfully make a new
: model out of "whole cloth" isn't likely. Your success has little to
: do with the internal mechanics of the spice you are modeling for; but
: alot to do with your interdisciplinary knowledge (of spice, software
: engineering, electronics, physics, etc.).

It's probably worthwhile to differentiate between making new models
and new SPICE devices. There's as much SPICE modeling done by junior
engineers or by contract with places like mainland China or Bangalore
as by Ph.D's, though I interact with all. Most any design engineer
using SPICE at one time or another needs to make a model for their own
use. But adding a new semiconductor device to SPICE, like and entirely
new MOSFET, isn't done by very many people.

Your point seemes to be that you have to have a triple PhD in
physics, circuits, and compilers, and belong to the elite SPICE
club to get paid big bux for working on SPICE. This is elitest
nonsense. Moreover, your arguments belie an attitude of sour
clubbiness which don't contribute to your point.
I didn't think *anyone* was trying to say this. Certainly the advice
I give is spirited as an invitation to pick it up if you're
interested. It is one of the more interdisplainary things I've
seen, because in addition to a good sense of electrical engineering
and computer science, an understanding of how compilers are
implemented is extremely useful. The SPICE program is basically a
compiler. It can be difficult to understand the hows and whys of
its coding style if you aren't familiar with compilers.

--Mike
 
Mike Engelhardt wrote:
Actually it is pretty much a closed club. The number if folks that
can successfully create a useful model for ANY spice is very few.
You can't do it unless you understand both spice, and the underlying
physics of the device very well. You can tweek some "Beethoven's"
model here and there and *perhaps* get a useful result, but to
successfully make a new model out of "whole cloth" isn't likely.
Your success has little to do with the internal mechanics of the
spice you are modeling for; but alot to do with your
interdisciplinary knowledge (of spice, software engineering,
electronics, physics, etc.).

It's probably worthwhile to differentiate between making new models
and new SPICE devices. There's as much SPICE modeling done by junior
engineers or by contract with places like mainland China or Bangalore
as by Ph.D's, though I interact with all. Most any design engineer
using SPICE at one time or another needs to make a model for their own
use.
Just to clarify, were talking spice ".model" and ".subckt" text models,
and this is correct.

But adding a new semiconductor device to SPICE, like and
entirely new MOSFET, isn't done by very many people.
Yes.

Your point seemes to be that you have to have a triple PhD in
physics, circuits, and compilers, and belong to the elite SPICE
club to get paid big bux for working on SPICE. This is elitest
nonsense. Moreover, your arguments belie an attitude of sour
clubbiness which don't contribute to your point.

I didn't think *anyone* was trying to say this. Certainly the advice
I give is spirited as an invitation to pick it up if you're
interested. It is one of the more interdisplainary things I've
seen, because in addition to a good sense of electrical engineering
and computer science,
I think you only really need common sense and the basics of the
disciplines.

I don't claim any sort of good computer science understanding at all,
yet I've added the latest Berkley models, parker jfet models, fixed
memory problems, added real time component change, temperature sweep,
extra parameters, current probing for bsim3, etc... all by commonsense
hacking. Even the .save @q1[ic] was broken in my version of the code
when I got it. As you often point out, I am idiot, yet my stuff does
demonstrably work, so it cant be all that difficult can it.

an understanding of how compilers are
implemented is extremely useful.
Off hand, I cant think of any compiler specific stuff that I have used
in my spice mods, and that's probably because I don't know much about
the details of compilers at all. I added my parameter expression
calculator so my GUI can process equations in subckts by simply getting
freebee code off the web. It has all this recursive parsing technical
stuff at all sorts of levels, not that I'll ever figure out how it works
in detail, or need to. Its one of the points of C++. Use a component as
is. Its like buying an LT opamp to use in an analogue filter. There's
absolutely no requirement to understand how it works at all, only what
it does. Knowing why is just a bonus.

I must admit though, that my DeviceDesginer feature came about because
of specific analogue design knowledge.


The SPICE program is basically a
compiler.
I don't think it as that way at all. However, I agree, in general, one
persons "complier" is another persons "application".

It can be difficult to understand the hows and whys of
its coding style if you aren't familiar with compilers.
But "why" isn't necessary to get useful things done. You need to know
what linked list is, and a few bits and bobs, but other than that,
engineering is all about knowing the input and output spec and not
worrying about why. Most products are far too complicated to understand
all the bits. You have to just accept something as given to get anything
done at all. How many parts does the space shuttle have?

Kevin Aylward
salesEXTRACT@anasoft.co.uk
http://www.anasoft.co.uk
SuperSpice, a very affordable Mixed-Mode
Windows Simulator with Schematic Capture,
Waveform Display, FFT's and Filter Design.
 
In article <K4F9b.1483$065.1059191@news1.news.adelphia.net>,
j.michael.elliottAT@REMOVETHEOBVIOUSadelphiaDOT.net says...
Active8 wrote:

i sometimes look for Kevin/Mike exchanges in the thread view just to
break the monotony :) this one wasn't very good. the flame level
just wasn't there. they're slacking.

but that brings up something i've been thinking of lately.
considering that the PSpice documentation raises more questions than
it answers... that the docs are nearly useless...

i was thinking it may have been easier to just use SS and LTSpice for
sims. you know, generate a netlist from SS where at least the
capture part is a no brainer. at least creating parts should be
easier than it is in LTSpice. drop the netlist in LTSpice and probe
the output in SS.

can you imagine the shit that could get started between those two
when i start hammering them both with questions? :) ^2

Oh, that would be good. That would be very good. Sort of the cyber
equivalent of tossing two cats in a bag, but without the cruelty, since
any damage would be self-inflicted by two humans who, unlike cats, have
choice in the matter.

I like the way you think.
ok. get your boss(es) to pull out the stops on the funding for that code
you want me to write. i can't even remember what it was you wanted to
add.

Start selling the tickets
state fair's in town next week. i'll see if i can get a vendor or the
ticket office to take a few tens of thousands on consignment. they can
ask the demolition derby customers, "Will you be liking to enjoy a tasty
flame war with your front row seats, sir?" I could sell anything at this
fair. but the ink jet refill gal's got to go. she's such a fraud.

brs,
mike
i've saved as many of helmut's LTSpice answers as i came across, just
in case. he's put out some good help for creating new parts. maybe
Linear should put him on the payroll.


Helmut's stuff is top-notch.

MikeE
 
In article <IqF9b.127$Kc3.81@newsfep3-gui.server.ntli.net>,
kevin@anasoft.co.uk says...
Active8 wrote:
In article <nerbmv4ore19pip4obbghsi9bmqaevh445@4ax.com>, Jim-T@golana-
will-get-you.com says...


but that brings up something i've been thinking of lately. considering
that the PSpice documentation raises more questions than it answers...
that the docs are nearly useless...

i was thinking it may have been easier to just use SS and LTSpice for
sims. you know, generate a netlist from SS where at least the capture
part is a no brainer. at least creating parts should be easier than it
is in LTSpice. drop the netlist in LTSpice and probe the output in SS.

For referance, you can just drag the SS netlist to LTSpice and run, but
make sure LT has been set to ASCII data file mode. Then use the SS file
menu to load in the/all LTSpice rawfile(s). This then gives you full
schematic x-probing. Obviously, its on the long runs that this is most
useful for.
ok. i remember that much.
Note that you have to press the pink "I" button at last once first. This
generates a blank include file that the SS netlist always has an entry
for. Unfortunately, LTSpice exits the sim if it can't find a netlist
declared include file.
duly noted.
LTSpice must have a spice type command line interface, but I have no
idea what it is, so I cant set it up to be transparent.
hmmm...

Any other
standard Unix type command line spice can be ran transparently from SS.
oh. you've got my attention. i'd love to be able to click a button and
have a net list sent to my Linux box. a real OS! time to check out the
Wine, no?

tnx,
mike
Kevin Aylward
salesEXTRACT@anasoft.co.uk
http://www.anasoft.co.uk
SuperSpice, a very affordable Mixed-Mode
Windows Simulator with Schematic Capture,
Waveform Display, FFT's and Filter Design.
 
[snip]
It can be difficult to understand the hows and whys of
its coding style if you aren't familiar with compilers.


But "why" isn't necessary to get useful things done. You need to know
what linked list is, and a few bits and bobs, but other than that,
engineering is all about knowing the input and output spec and not
worrying about why. Most products are far too complicated to understand
all the bits. You have to just accept something as given to get anything
done at all. How many parts does the space shuttle have?
in case yer interested, before i took my brainbench C++ cert test, i
found an online copy of the ANSI/ISO C++ standard draft. the final book
costs something like $750, but the draft is online and you can see the
proposals in comment and all that.

point is, certain parts of the std gave me a little insight into how the
compiler works. prior to that, i just knew how assemblers and compilers
worked in general. i suppose the best part is knowing how the compiler
allocates memory - that's how it's stated. we both know there ain't no
compiler in action at runtime.

but i don't see where a *deep* understanding of compilers would help me.
if i needed to parse a netlist or source file i'd just write my own
compiler. back when the 68000 chip came out, i started writing a 68000
MACRO assembler in 68000 assembly. no biggie. hash/jump table keyword
lookup, boolean ops on the op code to set the flags or immediate args,
tack on the immediate/absolute/indirect args.


BTW in case you hadn't heard about the proposal a couple years ago, it's
now standard that the loop variable in a for loop is now local to the
loop or rather the loop control statement, i.e.,

for(int i=0; i<5; i++)
{
}

used to be that i (heh! i should have used j) would be file scope and a
redeclaration later threw a compiler error. now you have to redeclare
because i is no longer visible outside of the control stmnt. this is
gonna cause probs in existing code, for sure. i used to have an example
in my head of how this would foul things up, but i can't remember. there
was discussion on comp.lang.c++ about how to work around this with
macros.

i guess an e.g. would be

for(int i=0; i<5; i++)
{
...
if(something evals to true) break;
}

int iLoopIters = i;

i'm pretty sure this is a valid e.g. it's close enough but i should
double check.

on a new compiler, you'd have to declare i prior to the loop to get the
last line of this frag to compile. but the i in the loop is not the same
i that's used later. the i in the loop control is not visible outside
the loop. not sure if the latest microshaft compilers implement the new
std.

later,
mike



Kevin Aylward
salesEXTRACT@anasoft.co.uk
http://www.anasoft.co.uk
SuperSpice, a very affordable Mixed-Mode
Windows Simulator with Schematic Capture,
Waveform Display, FFT's and Filter Design.
 
Active8 wrote:
It can be difficult to understand the hows and whys of
its coding style if you aren't familiar with compilers.


But "why" isn't necessary to get useful things done. You need to know
what linked list is, and a few bits and bobs, but other than that,
engineering is all about knowing the input and output spec and not
worrying about why. Most products are far too complicated to
understand all the bits. You have to just accept something as given
to get anything done at all. How many parts does the space shuttle
have?

in case yer interested, before i took my brainbench C++ cert test, i
found an online copy of the ANSI/ISO C++ standard draft. the final
book costs something like $750, but the draft is online and you can
see the proposals in comment and all that.

point is, certain parts of the std gave me a little insight into how
the compiler works. prior to that, i just knew how assemblers and
compilers worked in general. i suppose the best part is knowing how
the compiler allocates memory - that's how it's stated. we both know
there ain't no compiler in action at runtime.

but i don't see where a *deep* understanding of compilers would help
me.
It cant. Its simply nor relevant.

if i needed to parse a netlist or source file i'd just write my
own compiler. back when the 68000 chip came out, i started writing a
68000 MACRO assembler in 68000 assembly. no biggie. hash/jump table
keyword lookup, boolean ops on the op code to set the flags or
immediate args, tack on the immediate/absolute/indirect args.


BTW in case you hadn't heard about the proposal a couple years ago,
it's now standard that the loop variable in a for loop is now local
to the loop or rather the loop control statement, i.e.,

for(int i=0; i<5; i++)
{
}
At least you open an close the brackets in the correct place. Mkae
everthing line up. Those that open on the same line as the for() are
right bloody twats.

That's the way I usually code.

used to be that i (heh! i should have used j) would be file scope and
a redeclaration later threw a compiler error. now you have to
redeclare because i is no longer visible outside of the control
stmnt. this is gonna cause probs in existing code, for sure. i used
to have an example in my head of how this would foul things up, but i
can't remember. there was discussion on comp.lang.c++ about how to
work around this with macros.
I never use macros (except for ones the VC compiler uses). It defeats
some of the fundamental aspects of c++.

i guess an e.g. would be

for(int i=0; i<5; i++)
{
...
if(something evals to true) break;
}

int iLoopIters = i;

i'm pretty sure this is a valid e.g. it's close enough but i should
double check.

on a new compiler, you'd have to declare i prior to the loop to get
the last line of this frag to compile. but the i in the loop is not
the same i that's used later. the i in the loop control is not
visible outside the loop. not sure if the latest microshaft compilers
implement the new std.
I doubt if new MS stuff will break existing code on this point. Frankly,
I don't a toss about what any committee declares is c++. MS is the law
and Supreme Court in my book. That's all I use.


Kevin Aylward
salesEXTRACT@anasoft.co.uk
http://www.anasoft.co.uk
SuperSpice, a very affordable Mixed-Mode
Windows Simulator with Schematic Capture,
Waveform Display, FFT's and Filter Design.
 
Kevin Aylward wrote:

for(int i=0; i<5; i++)
{
}


At least you open an close the brackets in the correct place. Mkae
everthing line up. Those that open on the same line as the for() are
right bloody twats.

That's the way I usually code.

Tell it to Dennis Richie, the designer of the "C" language, he codes:

for(;;){
}

As do I.

The reason I format my "C" code that way is it saves 1 line per block.
This makes it easier to see an entire complicated block in a single
screen without in any way obscuring the block nature of the language.

If are used to the language, it is no problem to see the beginning
letter of the for, while, if, function, ... as the beginning of that
block.

But seriously, this is simply a matter of personal preference...
I've never met a good "C" programmer who couldn't bounce back and
forth from one style to the other as necessary. But given that it
is you Kevin, it really doesn't surprise me that you would be so
intolerant of coding styles that don't match your own.

-Chuck
 
Chuck Harris wrote:
Kevin Aylward wrote:


for(int i=0; i<5; i++)
{
}


At least you open an close the brackets in the correct place. Mkae
everthing line up. Those that open on the same line as the for() are
right bloody twats.

That's the way I usually code.


Tell it to Dennis Richie, the designer of the "C" language,
I would.

he codes:
I know. Its dreadful. I'm not impressed by appeals to authority. The
fact that he designed C makes not one iota of a difference about a
decent way to physically write it.

As do I.

The reason I format my "C" code that way is it saves 1 line per block.
I have heard of this reason. Makes no real sense to me. Why care. I
generally double space anyway. Its far cleaner.

This makes it easier to see an entire complicated block in a single
screen without in any way obscuring the block nature of the language.
imo, this claimed advantage does not outweigh the disadvantage.

If are used to the language, it is no problem to see the beginning
letter of the for, while, if, function, ... as the beginning of that
block.
I can only guess that you haven't really tried the make all {} match up.

for()
{
while()
{
if()
{

}
else
{

}
}
}

Hope the above comes out correct. It should all line up.

Its makes so much sense to do this. Its intuitively obvious. You know
what connects up with what in this approach. It was a joy to discover MS
VC does this automatically when you do a return, as I have always used
this method.

But seriously, this is simply a matter of personal preference...
And I prefer that others use my preference:)

I've never met a good "C" programmer who couldn't bounce back and
forth from one style to the other as necessary.
I'm usually pretty consistent. On occasions I may squash a few things to
the same line.

But given that it
is you Kevin, it really doesn't surprise me that you would be so
intolerant of coding styles that don't match your own.
I must admit that I can be quite a bigot at times, which I feel is much
better then being a hypocrite.

Kevin Aylward
salesEXTRACT@anasoft.co.uk
http://www.anasoft.co.uk
SuperSpice, a very affordable Mixed-Mode
Windows Simulator with Schematic Capture,
Waveform Display, FFT's and Filter Design.
 
Hi Kevin,

I will admit that in the early days when we were all using
80 x 24 displays the need to make sure that most blocks were
less than 20 or so lines was more compelling. Now, with
200 character lines, and 80 line screens, it isn't quite
so important. (now good eyesight is more important)

As to the alignment problems, I have been using emacs style
editors since about 1979. They all have a facility to show
matches to the different forms of braces when you type the
closing brace. They also all have an "electric-C mode"
that will take care of indentation and block positioning.
So it is really hard to get the closing brace lost, or forgotten.
Electric-C will adapt to which ever coding style you tend to
use.

Since this argument has existed before C even existed,
there are various "pretty printer" filters that will convert
from K&R style to pascal style, or vice versa. GNU emacs
has a pretty printer built in. (what doesn't GNU emacs have
built in?)

Tabs, 4 or 8 column, verses spaces are another area where religion
over takes reason.

Pick a style, and use it faithfully. The pro's will figure it
out when they have to work on your code. If your style is too
disgusting, or unconventional, a pretty printer will fix it.


Kevin Aylward wrote:

I'm usually pretty consistent. On occasions I may squash a few things to
the same line.


But given that it
is you Kevin, it really doesn't surprise me that you would be so
intolerant of coding styles that don't match your own.


I must admit that I can be quite a bigot at times, which I feel is much
better then being a hypocrite.
I agree, I guess? I am not sure that either characteristic is an
admirable one that you should strive for.

-Chuck
 
Chuck Harris wrote:
Hi Kevin,




I must admit that I can be quite a bigot at times, which I feel is
much better then being a hypocrite.

I agree, I guess? I am not sure that either characteristic is an
admirable one that you should strive for.
Well, no ones perfect, I do at least try to be honest.

Kevin Aylward
salesEXTRACT@anasoft.co.uk
http://www.anasoft.co.uk
SuperSpice, a very affordable Mixed-Mode
Windows Simulator with Schematic Capture,
Waveform Display, FFT's and Filter Design.
 
Chuck Harris wrote:
Hi Kevin,

I will admit that in the early days when we were all using
80 x 24 displays the need to make sure that most blocks were
less than 20 or so lines was more compelling. Now, with
200 character lines, and 80 line screens, it isn't quite
so important. (now good eyesight is more important)

As to the alignment problems, I have been using emacs style
editors since about 1979. They all have a facility to show
matches to the different forms of braces when you type the
closing brace. They also all have an "electric-C mode"
that will take care of indentation and block positioning.
So it is really hard to get the closing brace lost, or forgotten.
Electric-C will adapt to which ever coding style you tend to
use.

Since this argument has existed before C even existed,
there are various "pretty printer" filters that will convert
from K&R style to pascal style, or vice versa. GNU emacs
has a pretty printer built in. (what doesn't GNU emacs have
built in?)

Tabs, 4 or 8 column, verses spaces are another area where religion
over takes reason.

Pick a style, and use it faithfully. The pro's will figure it
out when they have to work on your code. If your style is too
disgusting, or unconventional, a pretty printer will fix it.


Kevin Aylward wrote:

I'm usually pretty consistent. On occasions I may squash a few
things to the same line.


But given that it
is you Kevin, it really doesn't surprise me that you would be so
intolerant of coding styles that don't match your own.


I must admit that I can be quite a bigot at times, which I feel is
much better then being a hypocrite.

I agree, I guess? I am not sure that either characteristic is an
admirable one that you should strive for.
However, arguable, its what 90% of Americans are quite happy with, and
usually actively encourage it.
Definition
bigot [Show phonetics]
noun [C] DISAPPROVING
a person who has strong, unreasonable beliefs and who thinks that anyone
who does not have the same beliefs is wrong:


That is, those who believe in a god usually think it is quite ok to have
people running around shoving their message down everyone's throat, i.e
in tv, newspapers, street corners, 10000's of churches etc.

Kevin Aylward
salesEXTRACT@anasoft.co.uk
http://www.anasoft.co.uk
SuperSpice, a very affordable Mixed-Mode
Windows Simulator with Schematic Capture,
Waveform Display, FFT's and Filter Design.
 
In article <Hv%9b.324$%N.217454@newsfep1-win.server.ntli.net>,
kevin@anasoft.co.uk says...
Active8 wrote:
[snip]
It can be difficult to understand the hows and whys of
its coding style if you aren't familiar with compilers.


But "why" isn't necessary to get useful things done. You need to know
what linked list is, and a few bits and bobs, but other than that,
engineering is all about knowing the input and output spec and not
worrying about why. Most products are far too complicated to
understand all the bits. You have to just accept something as given
to get anything done at all. How many parts does the space shuttle
have?

in case yer interested, before i took my brainbench C++ cert test, i
found an online copy of the ANSI/ISO C++ standard draft. the final
book costs something like $750, but the draft is online and you can
see the proposals in comment and all that.

point is, certain parts of the std gave me a little insight into how
the compiler works. prior to that, i just knew how assemblers and
compilers worked in general. i suppose the best part is knowing how
the compiler allocates memory - that's how it's stated. we both know
there ain't no compiler in action at runtime.

but i don't see where a *deep* understanding of compilers would help
me.

It cant. Its simply nor relevant.

if i needed to parse a netlist or source file i'd just write my
own compiler. back when the 68000 chip came out, i started writing a
68000 MACRO assembler in 68000 assembly. no biggie. hash/jump table
keyword lookup, boolean ops on the op code to set the flags or
immediate args, tack on the immediate/absolute/indirect args.


BTW in case you hadn't heard about the proposal a couple years ago,
it's now standard that the loop variable in a for loop is now local
to the loop or rather the loop control statement, i.e.,

for(int i=0; i<5; i++)
{
}

At least you open an close the brackets in the correct place. Mkae
everthing line up. Those that open on the same line as the for() are
right bloody twats.

That's the way I usually code.
there's 2 or 3 (4?) methods. one's kernihan(sp?) & ritchie (sp?) and
there's another major one. this is the the method common to java:

for(blah, blah){
crap code;} // or where ever the close it at.

i find it hard to read that. at Drexell U., they taught descent
formatting and all that. it stuck. people can actually read my code.

used to be that i (heh! i should have used j) would be file scope and
a redeclaration later threw a compiler error. now you have to
redeclare because i is no longer visible outside of the control
stmnt. this is gonna cause probs in existing code, for sure. i used
to have an example in my head of how this would foul things up, but i
can't remember. there was discussion on comp.lang.c++ about how to
work around this with macros.

I never use macros (except for ones the VC compiler uses). It defeats
some of the fundamental aspects of c++.

i agree to a degree. they have uses.

i guess an e.g. would be

for(int i=0; i<5; i++)
{
...
if(something evals to true) break;
}

int iLoopIters = i;

i'm pretty sure this is a valid e.g. it's close enough but i should
double check.

on a new compiler, you'd have to declare i prior to the loop to get
the last line of this frag to compile. but the i in the loop is not
the same i that's used later. the i in the loop control is not
visible outside the loop. not sure if the latest microshaft compilers
implement the new std.

I doubt if new MS stuff will break existing code on this point. Frankly,
I don't a toss about what any committee declares is c++. MS is the law
and Supreme Court in my book. That's all I use.
i use ms and other tools. we can (semi)disagree and still get by.

mike
Kevin Aylward
salesEXTRACT@anasoft.co.uk
http://www.anasoft.co.uk
SuperSpice, a very affordable Mixed-Mode
Windows Simulator with Schematic Capture,
Waveform Display, FFT's and Filter Design.
 
In article <bkabk0$91a$1@bob.news.rcn.net>, cfharris@erols.com says...
Kevin Aylward wrote:


for(int i=0; i<5; i++)
{
}


At least you open an close the brackets in the correct place. Mkae
everthing line up. Those that open on the same line as the for() are
right bloody twats.

That's the way I usually code.


Tell it to Dennis Richie, the designer of the "C" language, he codes:

for(;;){
}

As do I.
i can read it, but i'm not use to or fond of it. it reeks of java.
The reason I format my "C" code that way is it saves 1 line per block.
This makes it easier to see an entire complicated block in a single
screen without in any way obscuring the block nature of the language.
unless you add another line. then your on another screen.
If are used to the language, it is no problem to see the beginning
letter of the for, while, if, function, ... as the beginning of that
block.

But seriously, this is simply a matter of personal preference...
I've never met a good "C" programmer who couldn't bounce back and
forth from one style to the other as necessary. But given that it
is you Kevin, it really doesn't surprise me that you would be so
intolerant of coding styles that don't match your own.

-Chuck
c's nice for embedded, but C++ rules. those old c habits, functions,
etc. creeping into application codes are bad, IMHO.
mike
 
In article <7l4ab.1106$%N.515594@newsfep1-win.server.ntli.net>,
kevin@anasoft.co.uk says...
Chuck Harris wrote:
Kevin Aylward wrote:


for(int i=0; i<5; i++)
{
}


At least you open an close the brackets in the correct place. Mkae
everthing line up. Those that open on the same line as the for() are
right bloody twats.

That's the way I usually code.


Tell it to Dennis Richie, the designer of the "C" language,

I would.

he codes:

for(;;){
}

I know. Its dreadful. I'm not impressed by appeals to authority. The
fact that he designed C makes not one iota of a difference about a
decent way to physically write it.
i thought stroustroup designed c and ritchie wrote a good book.
As do I.

The reason I format my "C" code that way is it saves 1 line per block.

I have heard of this reason. Makes no real sense to me. Why care. I
generally double space anyway. Its far cleaner.

This makes it easier to see an entire complicated block in a single
screen without in any way obscuring the block nature of the language.

imo, this claimed advantage does not outweigh the disadvantage.


If are used to the language, it is no problem to see the beginning
letter of the for, while, if, function, ... as the beginning of that
block.

I can only guess that you haven't really tried the make all {} match up.

for()
{
while()
{
if()
{

}
else
{

}
}
}
as long as the close is lined up at least, you can see if you've matched
up the brackets.
Hope the above comes out correct. It should all line up.

Its makes so much sense to do this. Its intuitively obvious. You know
what connects up with what in this approach. It was a joy to discover MS
VC does this automatically when you do a return, as I have always used
this method.
that is a nice feature.
But seriously, this is simply a matter of personal preference...

And I prefer that others use my preference:)
god damnit!! it's my way or the highway!

mike
I've never met a good "C" programmer who couldn't bounce back and
forth from one style to the other as necessary.

I'm usually pretty consistent. On occasions I may squash a few things to
the same line.

But given that it
is you Kevin, it really doesn't surprise me that you would be so
intolerant of coding styles that don't match your own.

I must admit that I can be quite a bigot at times, which I feel is much
better then being a hypocrite.
tell it like it is and be hated. keeps undesireables away. :) clint
eastwood, me, who else?

mike
Kevin Aylward
salesEXTRACT@anasoft.co.uk
http://www.anasoft.co.uk
SuperSpice, a very affordable Mixed-Mode
Windows Simulator with Schematic Capture,
Waveform Display, FFT's and Filter Design.
 
In article <bkb0nt$nid$1@bob.news.rcn.net>, cfharris@erols.com says...
Hi Kevin,

I will admit that in the early days when we were all using
80 x 24 displays the need to make sure that most blocks were
less than 20 or so lines was more compelling. Now, with
200 character lines, and 80 line screens, it isn't quite
so important. (now good eyesight is more important)
i try to use line continues in long strings and hit return when the args
start running off the right side.
As to the alignment problems, I have been using emacs style
editors since about 1979. They all have a facility to show
matches to the different forms of braces when you type the
closing brace. They also all have an "electric-C mode"
that will take care of indentation and block positioning.
So it is really hard to get the closing brace lost, or forgotten.
Electric-C will adapt to which ever coding style you tend to
use.

Since this argument has existed before C even existed,
there are various "pretty printer" filters that will convert
from K&R style to pascal style, or vice versa. GNU emacs
has a pretty printer built in. (what doesn't GNU emacs have
built in?)

Tabs, 4 or 8 column, verses spaces are another area where religion
over takes reason.

Pick a style, and use it faithfully. The pro's will figure it
out when they have to work on your code. If your style is too
disgusting, or unconventional, a pretty printer will fix it.


Kevin Aylward wrote:

I'm usually pretty consistent. On occasions I may squash a few things to
the same line.


But given that it
is you Kevin, it really doesn't surprise me that you would be so
intolerant of coding styles that don't match your own.


I must admit that I can be quite a bigot at times, which I feel is much
better then being a hypocrite.

I agree, I guess? I am not sure that either characteristic is an
admirable one that you should strive for.
balance can be achieved. i just abhorr ass-kissing. but you can't sell
out your own values. sometimes it's best to shut up.

mike
 
In article <d4dab.49$xD2.58169@newsfep2-gui.server.ntli.net>,
kevin@anasoft.co.uk says...
Chuck Harris wrote:
Hi Kevin,

I will admit that in the early days when we were all using
80 x 24 displays the need to make sure that most blocks were
less than 20 or so lines was more compelling. Now, with
200 character lines, and 80 line screens, it isn't quite
so important. (now good eyesight is more important)

As to the alignment problems, I have been using emacs style
editors since about 1979. They all have a facility to show
matches to the different forms of braces when you type the
closing brace. They also all have an "electric-C mode"
that will take care of indentation and block positioning.
So it is really hard to get the closing brace lost, or forgotten.
Electric-C will adapt to which ever coding style you tend to
use.

Since this argument has existed before C even existed,
there are various "pretty printer" filters that will convert
from K&R style to pascal style, or vice versa. GNU emacs
has a pretty printer built in. (what doesn't GNU emacs have
built in?)

Tabs, 4 or 8 column, verses spaces are another area where religion
over takes reason.

Pick a style, and use it faithfully. The pro's will figure it
out when they have to work on your code. If your style is too
disgusting, or unconventional, a pretty printer will fix it.


Kevin Aylward wrote:

I'm usually pretty consistent. On occasions I may squash a few
things to the same line.


But given that it
is you Kevin, it really doesn't surprise me that you would be so
intolerant of coding styles that don't match your own.


I must admit that I can be quite a bigot at times, which I feel is
much better then being a hypocrite.

I agree, I guess? I am not sure that either characteristic is an
admirable one that you should strive for.


However, arguable, its what 90% of Americans are quite happy with, and
usually actively encourage it.
Definition
bigot [Show phonetics]
noun [C] DISAPPROVING
a person who has strong, unreasonable beliefs and who thinks that anyone
who does not have the same beliefs is wrong:
sounds like one of my old partners. how 'bout Archie Bunker?

mike
That is, those who believe in a god usually think it is quite ok to have
people running around shoving their message down everyone's throat, i.e
in tv, newspapers, street corners, 10000's of churches etc.

Kevin Aylward
salesEXTRACT@anasoft.co.uk
http://www.anasoft.co.uk
SuperSpice, a very affordable Mixed-Mode
Windows Simulator with Schematic Capture,
Waveform Display, FFT's and Filter Design.
 
Active8 wrote:

Tell it to Dennis Richie, the designer of the "C" language, he codes:

for(;;){
}

As do I.


i can read it, but i'm not use to or fond of it. it reeks of java.
It can't reek of java, it preceeds java by more than 20 years!

the style:

for(;;){
}

is known as *K&R style*. I know, because I have been using it since
the late '70s when I was programming in "C" on early Unix edition 6 and
7 on PDP-11/70s.

The reason I format my "C" code that way is it saves 1 line per block.
This makes it easier to see an entire complicated block in a single
screen without in any way obscuring the block nature of the language.


unless you add another line. then your on another screen.

If are used to the language, it is no problem to see the beginning
letter of the for, while, if, function, ... as the beginning of that
block.

But seriously, this is simply a matter of personal preference...
I've never met a good "C" programmer who couldn't bounce back and
forth from one style to the other as necessary. But given that it
is you Kevin, it really doesn't surprise me that you would be so
intolerant of coding styles that don't match your own.

-Chuck



c's nice for embedded, but C++ rules. those old c habits, functions,
etc. creeping into application codes are bad, IMHO.
C++ needlessly bloats the code. It is the primary reason that
people need 160GB hard disks, and 1Gb of ram on their computers.

A good programmer writes good code. It doesn't matter much what
language he uses. C++ allows ALL of C's dirty tricks, and more.
 
Active8 wrote:

I know. Its dreadful. I'm not impressed by appeals to authority. The
fact that he designed C makes not one iota of a difference about a
decent way to physically write it.


i thought stroustroup designed c and ritchie wrote a good book.
Nope!

Bjarne Stroustroup designed C++. He did it in the late '70s, early
'80s, Dennis Richie designed C in the early '70s, Brian Kernighan helped
Dennis Richie write the book.


tell it like it is and be hated. keeps undesireables away. :) clint
eastwood, me, who else?

mike
 

Welcome to EDABoard.com

Sponsor

Back
Top