Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

Forcing yourself to indent code?

Name: Anonymous 2010-04-22 15:00

How do you do it, guys?
I seem to only really indent my code when I use python.

tl;dr how can I improve my coding style?

Name: Anonymous 2010-04-22 15:03

>>1
Just become one with the FV and you will transcend the need to indent--even in Python.

Name: Anonymous 2010-04-22 15:04

I seem to only really indent my code when I use python.
People indent in python?

Name: Anonymous 2010-04-22 15:41

My editor(Emacs) does all the indenting for me.
It helps that the language has very specific indentation rules which can be applied automatically by the editor.

Name: Anonymous 2010-04-22 15:43

how can u actually read unindented code?

Name: Anonymous 2010-04-22 15:50

>>1
cindent

IHBT

Name: Anonymous 2010-04-22 16:18

>>5
How can you read anything but justified double-spaced 16-point proportional Polychromatic Baroque Gothic Extra-Serif 2400dpi font, with inline multimedia smiley extensions?

Name: Anonymous 2010-04-22 17:39

>>1
how can I improve my coding style?

Don't use FIOC!! Problem solved.

Name: Anonymous 2010-04-22 19:20

>>7
inline multimedia smiley extension?
Like Stack:(:O)verflow?

Name: Anonymous 2010-04-22 19:32

>>7
Please don't make fun of the art of typeface design.

Name: Anonymous 2010-04-22 20:28

>>10
Sorry, next time I'll be sure to mention that it includes Facebook ConnectPlatform.

>>9
http://comichunter.net/nowhere/dump/pmoticom001.gif
http://comichunter.net/nowhere/dump/pmoticom003.gif

Imagine the likes of that with sound and, in a future version, haptics.

Name: Anonymous 2010-04-22 20:43

>>10
He is obviously a Typical Windows User

Name: Anonymous 2010-04-22 20:49

>>12
Wouldn't a freetard be more likely to make fun of typeface design? What with the lack of a complete TTF implementation and all...

Name: Anonymous 2010-04-22 21:12

>>13
Just as likely as someone subjected to the horrors of ClearType. And the latter is a larger group of bigger morons.

Name: Anonymous 2010-04-22 21:31

>>14
You're too close to the screen. Step back and feel the love

Name: Anonymous 2010-04-22 21:38

>>14
Is that supposed to be bait?

Name: Anonymous 2010-04-22 23:05

>>15
Might as well turn it off then.

When are we going to get 300dpi monitors?

Name: Anonymous 2010-04-22 23:11

Or 600dpi, even

Name: Anonymous 2010-04-22 23:23

>>17
Get a Droid then.

Name: Anonymous 2010-04-22 23:29

gofmt

Name: Anonymous 2010-04-22 23:56

>>20
go fmt.yourself()

Name: Anonymous 2010-04-23 4:06

>>21
Go fund a charity

Name: Anonymous 2010-04-23 4:27

>>17-18
unfortunately most users are morons who cant figure out how to properly configure the dpi setting on their operating system of choice, so when presented with a monitor with higher than normal pixel density they just complain that everything is too small and decide they don't like it. this means that unless someone comes up with a good way to automatically get the settings right, you're probably not going to get 300dpi monitors at all.

Name: Anonymous 2010-04-23 8:57

>>23
Doesn't DVI advertise the screen resolution? Sure that doesn't give you dot pitch (or maybe that's supplied too? I'd be entirely unsurprised by that) but larger screen sizes are typically meant to be viewed at a distance anyway.

Name: Anonymous 2010-04-23 10:20

>>24
It does, yes. But OS X retardedly has all the font sizes hard-coded, and the UI is designed with that expectation, so change the font and text starts overlapping or getting cut off. (Try it with Shapeshifter or something - some apps start looking terrible fast). Windows is less retarded, but defaults to 100dpi (or is it 96?) everywhere because otherwise their icons would either be too damn small or look more shitty, because most applications still don't have all the icon sizes. (Speaking of, when the hell are we going to have SVG icons on any of the ``commercial'' operating systems? That's the one thing Linux actually has right, out of all of the shit it's managed to fail at. You can't render a font, but damn, you sure can resize the icon.)

Name: Anonymous 2010-04-23 10:50

>>25
* Gtk+

Name: Anonymous 2010-04-23 12:46

>>25
You're clearly using the wrong Linux. My fonts are lovely; I haven't seen an icon on this screen since before I overwrote the default installation.

Name: Anonymous 2010-04-23 13:21

>>27
I don't use Linux.

Name: Anonymous 2010-04-23 14:12

>>28
DON'T USE MY ANUS

Name: Anonymous 2010-04-23 14:34

>>25
Oh, well I'm sort of discounting OS X. Don't you have to buy special monitors for Macs? I'm not sure whether I'm asking that seriously. The majority of us need hardware too, and it's not made by Apple so I don't see what OS X really has to do with it.

I'm not sure if you've heard, but Linux can render fonts. Linux can't render a subset of TTFs, assuming your FreeType is compiled in FreeTard mode (which admittedly it probably is.) Beyond that, it beats Windows at font rendering (except on the MS core fonts, which seem to employ patented technology to appear ugly on Windows and uglier everywhere else.)

As far as Macs go, I don't know. I'd say the dpi problem is the worst of the lot, but it's not a font rendering problem, it's something deeper. Personally though, MacOS anti-aliasing is what turns me off, which is a shame because doing AA on a glyph with subpixel features in proportion to point size is not actually conceptually difficult or computationally expensive. (The only time you should perceive blurring is when two or more subpixel features are competing for representation in the same pixel.)

Name: Anonymous 2010-04-23 18:53

>>29
I'LL HAX URANUS

Name: Anonymous 2010-04-23 21:43

Name: Anonymous 2010-04-23 21:58

>>32
What a horrible list. Shit like this is why I am against the axiom of choice.

Name: Anonymous 2010-04-24 2:29

>>33
¿¿¿???

Name: Anonymous 2010-04-24 4:12

tl;dr how can I improve my coding style?

Stop being lazy.

Name: Anonymous 2010-04-24 11:45

... It's just habit man.

The thing is, Notepad++ used to have this function: re-indent C code.

It was EPIC and worked on any C like language (PHP, Java, whatever)

I now do Ruby/Rails development and I haven't found anything that'll reindent it for me.

The problem is that my text-editor at home uses 3-space soft tabs; and my editor at uni uses 5-space hard-tabs. So they fucking HATE working with each other.

Name: Anonymous 2010-04-24 11:48

>>36
Just use a common denominator: 15-space tabs.

Name: Anonymous 2010-04-24 11:53

3 and 5? What the fuck?!

Both of your editors are idiotic.

Name: Anonymous 2010-04-24 15:30

>>37
That's not what a denominator is.

Name: Anonymous 2010-04-24 19:38

>>36

man vim

Name: Anonymous 2010-04-24 19:50

indent -linux *.c
/thread

Name: Anonymous 2010-04-24 20:15

>>41
I think indent has been abandoned and is not very useful nowadays. It performs rather miserably with C99 syntax, and I have even seen it crash when faced with certain C++ constructs.

That and it has way too many options, with highly clunky syntax. I occasionally fantasize of having an indenter that defined its rules based on contextual analysis of code snippets -- so the config file would essentially be a short C program on which to base the reindentation of its input files.

Name: Anonymous 2010-04-24 20:17

I prefer astyle.

Name: Anonymous 2010-04-24 20:26

M-x mark-whole-buffer then M-x indent-region or [m]C-SPC M-> C-M-[m]

Name: Anonymous 2010-04-24 21:13

>>42
indent is meant for C, why would you expect it to work with a different language?
Though obviously it doesn't crash even on Sepples code, and it doesn't have any difficulty with C99.

Name: Anonymous 2010-04-24 23:57

>>45
indent is an old and unmaintained codebase that is most definitely showing its age, and I'm not sure why you would even feel the inclination to argue otherwise, except maybe IHBT, but here's some perfectly valid C99 code that it completely fucks up:


#include <stdio.h>
struct label {
    int x, y;
    const char *s;
};
struct label labels[] = { {
    .x = 1,
    .y = 2,
    .s = "Abort",
}, {
    .x = 3,
    .y = 4,
    .s = "Retry",
}, {
    .x = 5,
    .y = 6,
    .s = "Ignore",
}, {
    .x = 7,
    .y = 8,
    .s = "Why does indent break this so badly?",
} }, another_label = {
    .x = 9,
    .y = 10,
    .s = "and it gives up entirely here",
};
void dumplabels(int n, struct label *args) {
    for (int a = 0; a < n; a++)
        printf("%d, %d: %s\n", args[a].x, args[a].y, args[a].s);
}
// slightly contrived, but really NOT much of a stretch from useful code.
int main(int argc, char **argv) {
    for (int a = 10, b = 0; b < 10; b++, a--)
        // indent crams this all together... more like obfuscate
        dumplabels(3, ((struct label[]) {
            {
                .x = a,
                .y = b,
                .s = "a and b",
            }, {
                .s = "no x/y given",
            }, {
                .y = a,
                .s = "y is a",
            },
        }));
    return 0;
}


astyle is marginally better here, but some of its styles botch the indentation fairly completely as well.

Name: Anonymous 2010-04-25 11:12

>>46
PERFECTLY VALID MY ANUS

Name: Anonymous 2010-04-26 9:04

>>47
*parses dick*

Name: Anonymous 2010-12-25 10:08

Name: Anonymous 2011-02-04 14:09

Don't change these.
Name: Email:
Entire Thread Thread List