世界上最恶劣的代码格式化风格 [英] The world's evilest code formatting style

查看:81
本文介绍了世界上最恶劣的代码格式化风格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C ++ ers:


赏心悦目:


void首页::

继承( IdentifierPtr const& id)

{

...

}


对于你们这些人谁还没弄明白,那就是方法

首页::继承()。


我想理论是那样的::是一个封闭类型,所以它应该假装包装方法,就像命名空间一样。


现在,因为它不是邪恶的这与普通风格相反,因此很难读懂。当它使Home ::继承无法进行
搜索时,它是完全邪恶的。对于大型项目来说,搜索是非常重要的!


有人能想到在发布的代码中看到的eviler风格吗? ;-)


-

Phlip
http://c2.com/cgi/wiki?ZeekLand < - 不是博客!!!

解决方案



Phlip写道:

在发布的代码中可以看到一个eviler风格吗? ; - )




是的。

http://code.axter.com/dynamic_2d_array.h

Google群组很可能在这里创造奇迹...所有以下是

4个并发行:


dynamic_2d_array(size_t row,size_t col):m_row(row),m_col(col),

m_data((行!= 0&& col!= 0)?new T [row * col]:NULL){}


dynamic_2d_array(const

dynamic_2d_array& src):m_row(src.m_row),m_col(src.m _col),

m_data((src.m_row!= 0&& src.m_col != 0)?new T [src.m_row * src.m_col]:NULL){size /t

for(size_t r = 0; r< m_row; ++ r)for(size_t c = 0; c
= src [r] [c];


}


猜猜他不想浪费任何空间或输入字符。


尽管如此糟透了......它没有那些右支撑的人那么糟糕......所以/>
称为右支撑......即:


无论是什么(){

for(int i = 0;我< 100; i ++){

printf(" whatever\\\
);

}

}


这就是愚蠢的愚蠢。我与之合作的一个人实际上说他这样做是因为把它放在下一行只会浪费一条线。我是b / b
认为他有一个大脑只是浪费宝贵的大脑,而其他人可以更好地利用它们。

" Phlip" < pH值****** @ yahoo.com>在消息中写道

news:_G ****************** @ newssvr11.news.prodigy.c om ...

C ++ ers:

大饱眼福:

void Home ::
inherits(IdentifierPtr const& id)
{
...
}

对于那些还没想到的人来说,那就是方法
Home :: inherits()。

我认为理论是Home ::是一个封闭类型,所以它应该假装包装方法,就像命名空间一样。

现在那个'不是邪恶只是因为它与普通风格相反,因此难以阅读。当它使Home :: inherits
无法搜索时,这是完全邪恶的。对于大项目来说,搜索很重要!

任何人都可以想到在发布的代码中看到的eviler风格吗? ;-)

-
Phlip
http://c2.com/cgi/wiki?ZeekLand < - 不是博客!!!



没有人写过:

虽然这很糟糕......但它并不像那些右支撑的人那么糟糕......所以
称为右支撑......即:

无论如何(){


哦,我的。我就是这个 - >< - 接近放弃免责声明不要提起

括号,但我认为没人......会。


每个人都抱怨大括号,一旦你结束它,你就完成它了,

你可以阅读,编辑和重构,无论傻乎乎的支撑
使用
约定。


我想在第一列中放置大多数(但不是全部)括号可能是

例外......


Noah Roberts引用:

dynamic_2d_array(size_t row,size_t col):m_row(row),m_col(col),
m_data(( row!= 0&& col!= 0)?new T [row * col]:NULL){}




现在 - 你也可以在Dinkumware的旧式STL风格。当你的远程同事写下不可维护的BASIC和疯狂的行时,这会让你的b $ b更糟糕

充满了2个字母变量的运行语句,因为我可以获得更多/>
屏幕就像那样。


让我们将问题缩小到A>的样式。在风格指南中可以理解,

和B>澄清的失败尝试,而不是成功的默默无闻。


-

Phlip
http://c2.com/cgi/wiki?ZeekLand < - 不是博客!!!


C++ers:

Feast your eyes:

void Home::
inherits (IdentifierPtr const& id)
{
...
}

For those of you who haven''t figured it out yet, that''s the method
Home::inherits().

I suppose the theory is that Home:: is an enclosing type, so it should
pretend to wrap the method, like a namespace.

Now that''s not evil just because it''s so contrary to common styles and hence
hard to read. It''s totally evil when it makes Home::inherits impossible to
search for. Searching, for big projects, is kind''a important!

Can anyone think of an eviler style, seen in published code? ;-)

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!

解决方案


Phlip wrote:

Can anyone think of an eviler style, seen in published code? ;-)



Yes.

http://code.axter.com/dynamic_2d_array.h

Google groups is likely to do wonders here...all of the following is on
4 concurrent lines:

dynamic_2d_array(size_t row, size_t col):m_row(row),m_col(col),
m_data((row!=0&&col!=0)?new T[row*col]:NULL){}

dynamic_2d_array(const
dynamic_2d_array&src):m_row(src.m_row),m_col(src.m _col),
m_data((src.m_row!=0&&src.m_col!=0)?new T[src.m_row*src.m_col]:NULL){

for(size_t r=0;r<m_row;++r)for(size_t c=0;c<m_col;++c) (*this)[r][c]
= src[r][c];

}

Guess he didn''t want to waste any space or enter characters.


Although that sucks... its not as bad as people who "right brace"... so
called "right bracers"... ie:

void Whatever() {
for (int i = 0; i < 100; i++) {
printf("whatever\n");
}
}

Thats just dumb beyond dumb. A guy I worked with actually said he does it
like that because "putting it on the next line just wastes a line". I''m
thinking the fact that he has a brain is just a waste of precious brain
cells that others could better utilize.
"Phlip" <ph******@yahoo.com> wrote in message
news:_G******************@newssvr11.news.prodigy.c om...

C++ers:

Feast your eyes:

void Home::
inherits (IdentifierPtr const& id)
{
...
}

For those of you who haven''t figured it out yet, that''s the method
Home::inherits().

I suppose the theory is that Home:: is an enclosing type, so it should
pretend to wrap the method, like a namespace.

Now that''s not evil just because it''s so contrary to common styles and
hence hard to read. It''s totally evil when it makes Home::inherits
impossible to search for. Searching, for big projects, is kind''a
important!

Can anyone think of an eviler style, seen in published code? ;-)

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!



Nobody wrote:

Although that sucks... its not as bad as people who "right brace"... so
called "right bracers"... ie:

void Whatever() {
Oh, my. I was this -><- close to putting in a disclaimer "don''t bring up
braces", but I figured that nobody ... would.

Everyone complains about braces, and once you are over it, you are over it,
and you can read, edit, and refactor, regardless of whatever silly bracing
convention is used.

I suppose putting most (but not all) braces in the first column might be an
exception there...

Noah Roberts cited:
dynamic_2d_array(size_t row, size_t col):m_row(row),m_col(col),
m_data((row!=0&&col!=0)?new T[row*col]:NULL){}



Now now - you may as well bust on Dinkumware''s old STL style. That gets
worse when your remote colleague writes unmaintainable BASIC and crams lines
full of run-on statements with 2-letter variables "because I can get more on
the screen like that".

Let''s narrow the question to a style that is A> hallowable in a style guide,
and B> a failed attempt at clarity, not a successful attempt at obscurity.

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!


这篇关于世界上最恶劣的代码格式化风格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆