On 4 Jul, 15:26, Hallvard B Furuseth <h.b.furus...@u sit.uio.nowrote :
I'd like to reformat an open source package (OpenLDAP) to a new C style.
8M code, 0.3M lines. With some currently hopeless formatting rules like
tab-width=4.
what's wrong with that?!
I'm sure that made sense once to save disk space for the
source code, or something:-(
wouldn't replacing spaces with tabs do that? Were disks ever
*that* small? I've worked on old mini-computers and even
then we didn't try to save space at the *source* level.
The project's normal rule is "don't
reformat unnecessarily" since it makes source control merge/diff
difficult.
use a decent configuration control system and make sure
you don't mix source code changes with reformats. Clearly label
the reformat versions.
can't help you with indent
<snip>
--
Nick Keighley 18 2841
Nick Keighley writes:
On 4 Jul, 15:26, Hallvard B Furuseth <h.b.furus...@u sit.uio.nowrote :
>I'd like to reformat an open source package (OpenLDAP) to a new C style. 8M code, 0.3M lines. With some currently hopeless formatting rules like tab-width=4.
what's wrong with that?!
Tab width 8 is the norm elsewhere, at least in the Unix world and with
published ASCII text. So some code gets written with tab-width 4, some
with 8. Even if everyone sets indentation = tab-width, code still gets
misaligned. This written with tab-width 4 (I've substituted spaces):
int foo; /* hi there */
const char *barbaz[256]; /* and here */
becomes this when displayed with tab-width 8:
int foo; /* hi there */
const char *barbaz[256]; /* and here */
>I'm sure that made sense once to save disk space for the source code, or something:-(
wouldn't replacing spaces with tabs do that?
Not if tab width indentation level. (e.g. 8 and 4).
Were disks ever *that* small? I've worked on old mini-computers and
even then we didn't try to save space at the *source* level.
Who knows. If the point was not to save space, I have no idea at all
what the point was.
>The project's normal rule is "don't reformat unnecessarily" since it makes source control merge/diff difficult.
use a decent configuration control system and make sure
you don't mix source code changes with reformats. Clearly label
the reformat versions.
Actually I'm not sure what a configuration control system is, as opposed
to source control. This project is still using CVS, and I'm not going
to fight about that. In any case the reformatting changes will
certainly not pay attention to the "don't reformat" rule:-)
--
Hallvard
Hallvard B Furuseth schrieb:
Who knows. If the point was not to save space, I have no idea at all
what the point was.
The point of using tabs is that everyone can easily convert to something
convenient. I find a value of 4 spaces perfect, some prefer 2, some
prefer 8. I've also seen 3.
You suggest that you switch to 8 spaces (i.e. no tabs) which seems to me
like a really not that good idea. After all everyone should be able to
display it the way he/she wants - not the way the programmer liked it.
Code indented by spaces is an annoying pest, IMHO.
Regards,
Johannes
--
"Wer etwas kritisiert muss es noch lange nicht selber besser können. Es
reicht zu wissen, daß andere es besser können und andere es auch
besser machen um einen Vergleich zu bringen." - Wolfgang Gerber
in de.sci.electron ics <47************ ***********@new s.freenet.de>
You suggest that you switch to 8 spaces (i.e. no tabs) which seems to me
like a really not that good idea. After all everyone should be able to
display it the way he/she wants - not the way the programmer liked it.
Code indented by spaces is an annoying pest, IMHO.
If you wish to maintain vertical aligment for whatever reason, then
you have to use spaces.
Of course having vertical alignment in source code is a matter of
personal taste
Reducing indent (tab) size increases the number of nested blocks that
dont require line wrapping, or allows the use of longer variable
names.
Increasing the indent size reduces the risk of vertical alignment
being upset if the tab size is changed as possibly only a single tab
is required to maintain alignment
On Fri, 4 Jul 2008 08:07:45 -0700 (PDT), Nick Keighley
<ni************ ******@hotmail. comwrote in comp.lang.c:
On 4 Jul, 15:26, Hallvard B Furuseth <h.b.furus...@u sit.uio.nowrote :
I'd like to reformat an open source package (OpenLDAP) to a new C style.
8M code, 0.3M lines. With some currently hopeless formatting rules like
tab-width=4.
what's wrong with that?!
I'm sure that made sense once to save disk space for the
source code, or something:-(
wouldn't replacing spaces with tabs do that? Were disks ever
*that* small? I've worked on old mini-computers and even
then we didn't try to save space at the *source* level.
Apparently you never coded C under CP/M 80 on single density 8" floppy
disks.
Or Pascal on early micros where the storage medium was a cassette
tape. I say Pascal, because I don't actually remember a
cassette-based C for the original TRS-80.
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.l earn.c-c++ http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
Jack Klein wrote:
On Fri, 4 Jul 2008 08:07:45 -0700 (PDT), Nick Keighley
<ni************ ******@hotmail. comwrote in comp.lang.c:
>On 4 Jul, 15:26, Hallvard B Furuseth <h.b.furus...@u sit.uio.nowrote :
>>I'd like to reformat an open source package (OpenLDAP) to a new C style. 8M code, 0.3M lines. With some currently hopeless formatting rules like tab-width=4.
what's wrong with that?!
>>I'm sure that made sense once to save disk space for the source code, or something:-(
wouldn't replacing spaces with tabs do that? Were disks ever *that* small? I've worked on old mini-computers and even then we didn't try to save space at the *source* level.
Apparently you never coded C under CP/M 80 on single density 8" floppy
disks.
Forget the disks, getting the source in memory was enough of a challenge!
--
Ian Collins.
Johannes Bauer wrote:
Hallvard B Furuseth schrieb:
>Who knows. If the point was not to save space, I have no idea at all what the point was.
The point of using tabs is that everyone can easily convert to something
convenient. I find a value of 4 spaces perfect, some prefer 2, some
prefer 8. I've also seen 3.
Fortran lives !!
Hallvard B Furuseth wrote:
Nick Keighley writes:
>On 4 Jul, 15:26, Hallvard B Furuseth <h.b.furus...@u sit.uio.nowrote :
>>I'd like to reformat an open source package (OpenLDAP) to a new C style. 8M code, 0.3M lines. With some currently hopeless formatting rules like tab-width=4.
what's wrong with that?!
Tab width 8 is the norm elsewhere, at least in the Unix world and with
published ASCII text.
Er no, but thats a religious war so don't go there.
So some code gets written with tab-width 4, some
with 8. Even if everyone sets indentation = tab-width, code still gets
misaligned. This written with tab-width 4 (I've substituted spaces):
int foo; /* hi there */
const char *barbaz[256]; /* and here */
becomes this when displayed with tab-width 8:
int foo; /* hi there */
const char *barbaz[256]; /* and here */
So reset your editor to use tab widths of 4. Job done.
Mark McIntyre wrote:
>Hallvard B Furuseth wrote:
> So some code gets written with tab-width 4, some with 8. Even if everyone sets indentation = tab-width, code still gets misaligned. This written with tab-width 4 (I've substituted spaces): int foo; /* hi there */ const char *barbaz[256]; /* and here */ becomes this when displayed with tab-width 8: int foo; /* hi there */ const char *barbaz[256]; /* and here */
So reset your editor to use tab widths of 4. Job done.
I should have clarified: The code was _originally_ written with tab
width 4. But by now it's sprinkled with quite a bit written with tab
widht 8. Open-source project, several authors... So it gets wrong
either way.
--
Hallvard
I should have clarified: The code was _originally_ written with tab
width 4. But by now it's sprinkled with quite a bit written with tab
widht 8. Open-source project, several authors... So it gets wrong
either way.
That doesn't make sense to me. A Tab is a tab - your editor should
convert 0x09 into whatever tabspace you've defined in your editor.
Presumably you mean that some moron has tab-to-spaced your code twice,
once at 4s/t and once at 8s/t.
In which case why not just run it through indent, setting appropriate
tabs (not spaces)? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Paul Kooistra |
last post by:
I need a tool to browse text files with a size of 10-20 Mb. These
files have a fixed record length of 800 bytes (CR/LF), and containt
records used to create printed pages by an external company.
Each line (record) contains an 2-character identifier, like 'A0' or
'C1'. The identifier identifies the record format for the line,
thereby allowing different record formats to be used in a textfile.
For example:
An A0 record may consist of:
|
by: Just Curious |
last post by:
Hello,
I am doing some XSLT tranformations. I have a pretty complicated XML
document with high level of nesting. I am looking for a tool that
gives me the "hierarchial path" to the element I select for example if
in the xml below - I select <City>XY</City> - I want to get
"Address/Address/City"
<Addresses>
<Address>
|
by: Shiperton Henethe |
last post by:
Dreamweaver 4
Hi
Can anyone recommend a decent utility for compressing
HTML that is safe - i.e. that *definitely* doesn't mess
with the appearance in any browsers.
I run a growing website whose pages are inexorably getting
too "heavy".
|
by: Akseli Mäki |
last post by:
Hi,
Hopefully this is not too much offtopic.
I'm working on a FAQ. I want to make two versions of it, plain text and
HTML. I'm looking for a tool that will make a plain text doc out of the
HTML doc. The HTML version doesn't have anything fancy, just internal
links. So the tool must be able to delete internal links and anchors from
the HTML version, but leave external links in simplified form. That is, the
HTML version would say <a...
|
by: Xiaopeng Xiong |
last post by:
If there is any command for formatting all files under a directory, that
would be best.
But currently, formatting a single file is enough for me. I just can not
type TAB at each line.
Thanks a lot!
--
Xiaopeng Xiong
| |
by: Roman |
last post by:
Hello group,
I'm wondering which authoring tool would be most flexible and useful for
large websites using only html, css and javascrip.
So far I've tried Dreamweaver MX, but have heard BBEdit is also good. What
do you think?
|
by: Rajnish |
last post by:
Hi C experts,
Please suggest me best c programming language tool, which is like
Jbuilder (for java) which suggest all avilable methods etc on typing
the object.
Best regards,
Rajnish
|
by: Tina |
last post by:
Does anyone know of an asp.net general purpose table editing tool that will
allow users to add modify and delete data?
Thanks,
T
|
by: BigDave |
last post by:
For a previous employer, I did a lot of BizTalk 2004 development, but
am no longer doing so, and do not even have BizTalk installed.
One of the things I miss is the BizTalk Scheme Editor, and how it
displayed elements in a vertical tree.
(Visual Studio 2005 Schema Editor and XMLSpy seem to want to display
elements in a horizontal tree, and to me, not as elegantly).
Does anyone know if the BizTalk Schema Editor can be obtained and used
|
by: dmarrese |
last post by:
I am a parent volunteer for a swim team website (makoswim.org) and am
looking for a recommendation for a new web authoring tool .
While I am technically oriented and have somehave some knowledge of
HTML but not a deep techie. I want to give this site an extreme
makeover. The tool I've been using has probably outlived it's
usefulness (IBM Websphere Home Page Builder
- out of support).
I need something easy to use. I'd like to add...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |