Header file Formating.
-
Not a programming question, keep you guns down. I just hate this kind of formatting.
class fooclass { void foo1; virtual void foo2; const int foo3; ....and 20 more apis };
:mad:The alignment or the massive whitespace? I am very, very strict about aligning code because it allows you to scan types, modifiers and names and reduces the chance of a scanning drive-by error. A little bit of effort that has saved me enough times to make it gospel.
cheers, Chris Maunder The Code Project Co-founder Microsoft C++ MVP
-
The alignment or the massive whitespace? I am very, very strict about aligning code because it allows you to scan types, modifiers and names and reduces the chance of a scanning drive-by error. A little bit of effort that has saved me enough times to make it gospel.
cheers, Chris Maunder The Code Project Co-founder Microsoft C++ MVP
Chris Maunder wrote:
The alignment or the massive whitespace?
too many whitespaceing. Some alignment is fine.
-
Not a programming question, keep you guns down. I just hate this kind of formatting.
class fooclass { void foo1; virtual void foo2; const int foo3; ....and 20 more apis };
:mad:Yeah, there should be a SPACE before the semi-colon.
-
Not a programming question, keep you guns down. I just hate this kind of formatting.
class fooclass { void foo1; virtual void foo2; const int foo3; ....and 20 more apis };
:mad:Here is what I do most of the time:
class laImageMaskResult : public laResult
{
typedef laResult Superclass;
Q_OBJECT
public:
laImageMaskResult();
laImageMaskResult(const laImageMaskResult & other);
virtual ~laImageMaskResult();
laImageMaskResult& operator=(const laImageMaskResult & other);enum Type { EMPTY\_MASK = 0x0000, SEGMENTED\_LUNG = 0x0001, AIRWAY\_SEEDS = 0x0002, DETCTED\_AIRWAYS = 0x0004, DETECTED\_FISSURES = 0x0008, }; Q\_DECLARE\_FLAGS(Types, Type);
public:
virtual bool SaveResult(QString strFolder,QString strFileName);
virtual bool LoadResult(QString strFolder,QString strFileName);
virtual bool LoadResult();
virtual void setType(Types ty);
virtual Types getType();
public:
laVTKLungImageMask* SetImageMask(laVTKLungImageMask* pMask);
laVTKLungImageMask* GetImageMask();
protected:
laVTKLungImageMask* m_pImageMask;
Types m_type;
private:
void copy(const laImageMaskResult & other);
void destroy();
};John
-
The alignment or the massive whitespace? I am very, very strict about aligning code because it allows you to scan types, modifiers and names and reduces the chance of a scanning drive-by error. A little bit of effort that has saved me enough times to make it gospel.
cheers, Chris Maunder The Code Project Co-founder Microsoft C++ MVP
-
Yeah, there should be a SPACE before the semi-colon.
I agree but I doubt there are many others.
BDF People don't mind being mean; but they never want to be ridiculous. -- Moliere
-
Can you force visual studio to keep the extra aligning whitespace without loosing all the other autoformatting to add white space where it's missing?
The latest nation. Procrastination.
You can either stop it auto-formatting, or you can hit Ctrl-Z after it auto-formats.
cheers, Chris Maunder The Code Project Co-founder Microsoft C++ MVP
-
Here is what I do most of the time:
class laImageMaskResult : public laResult
{
typedef laResult Superclass;
Q_OBJECT
public:
laImageMaskResult();
laImageMaskResult(const laImageMaskResult & other);
virtual ~laImageMaskResult();
laImageMaskResult& operator=(const laImageMaskResult & other);enum Type { EMPTY\_MASK = 0x0000, SEGMENTED\_LUNG = 0x0001, AIRWAY\_SEEDS = 0x0002, DETCTED\_AIRWAYS = 0x0004, DETECTED\_FISSURES = 0x0008, }; Q\_DECLARE\_FLAGS(Types, Type);
public:
virtual bool SaveResult(QString strFolder,QString strFileName);
virtual bool LoadResult(QString strFolder,QString strFileName);
virtual bool LoadResult();
virtual void setType(Types ty);
virtual Types getType();
public:
laVTKLungImageMask* SetImageMask(laVTKLungImageMask* pMask);
laVTKLungImageMask* GetImageMask();
protected:
laVTKLungImageMask* m_pImageMask;
Types m_type;
private:
void copy(const laImageMaskResult & other);
void destroy();
};John
That makes sense, I do the same... but another developer does what I mentioned in my original post. btw, You use QT rite?
-
You can either stop it auto-formatting, or you can hit Ctrl-Z after it auto-formats.
cheers, Chris Maunder The Code Project Co-founder Microsoft C++ MVP
99% of the time I want the autoformatting on. I was hoping I could do something like:
#I Know What I`m Doing //disable autoformat
Code with manually aligned whitespace
#Mommy Knows Best //enable autoformat
Code without any special whitespace
:rolleyes:
The latest nation. Procrastination.
modified on Wednesday, September 2, 2009 9:07 AM
-
That makes sense, I do the same... but another developer does what I mentioned in my original post. btw, You use QT rite?
-
99% of the time I want the autoformatting on. I was hoping I could do something like:
#I Know What I`m Doing //disable autoformat
Code with manually aligned whitespace
#Mommy Knows Best //enable autoformat
Code without any special whitespace
:rolleyes:
The latest nation. Procrastination.
modified on Wednesday, September 2, 2009 9:07 AM
Wouldn't "Mommy Knows Best" enable autoformat?
BDF People don't mind being mean; but they never want to be ridiculous. -- Moliere
-
That makes sense, I do the same... but another developer does what I mentioned in my original post. btw, You use QT rite?
Yes, that is Qt. Although that example is not one of the interesting ones that uses signals and slots.. I would have included one as an example but the first two I looked at were not following my general style.
John
-
Yeah, there should be a SPACE before the semi-colon.
You've got to be fucking kidding.
Software Zen:
delete this;
Fold With Us![^] -
Yeah, there should be a SPACE before the semi-colon.
are you sure? isn't it a newline and a whole bunch of spaces? :)
Luc Pattyn
:badger: :jig: :badger:
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
:jig: :badger: :jig:
-
are you sure? isn't it a newline and a whole bunch of spaces? :)
Luc Pattyn
:badger: :jig: :badger:
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
:jig: :badger: :jig:
No, one SPACE will do; there are too many on the line already.
-
The alignment or the massive whitespace? I am very, very strict about aligning code because it allows you to scan types, modifiers and names and reduces the chance of a scanning drive-by error. A little bit of effort that has saved me enough times to make it gospel.
cheers, Chris Maunder The Code Project Co-founder Microsoft C++ MVP
Same here. Ditto (in C++ anyway) using
const
appropriately. Of course, when a guy formats his code well it's called Metrosexual Programming[^], right? :rolleyes:Anna :rose: Having a bad bug day? Tech Blog | Anna's Place | Tears and Laughter "If mushy peas are the food of the devil, the stotty cake is the frisbee of God"
-
Wouldn't "Mommy Knows Best" enable autoformat?
BDF People don't mind being mean; but they never want to be ridiculous. -- Moliere
-
Same here. Ditto (in C++ anyway) using
const
appropriately. Of course, when a guy formats his code well it's called Metrosexual Programming[^], right? :rolleyes:Anna :rose: Having a bad bug day? Tech Blog | Anna's Place | Tears and Laughter "If mushy peas are the food of the devil, the stotty cake is the frisbee of God"
Anna-Jayne Metcalfe wrote:
Metrosexual Programming
Brilliant!
cheers, Chris Maunder The Code Project Co-founder Microsoft C++ MVP
-
Anna-Jayne Metcalfe wrote:
Metrosexual Programming
Brilliant!
cheers, Chris Maunder The Code Project Co-founder Microsoft C++ MVP
i thought you'd like that. :)
Anna :rose: Having a bad bug day? Tech Blog | Anna's Place | Tears and Laughter "If mushy peas are the food of the devil, the stotty cake is the frisbee of God"