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

Pages: 1-

What's the point of a standard library

Name: Anonymous 2009-03-29 9:28

if you can write most of what's there, but more efficiently, in five minutes?

Name: Anonymous 2009-03-29 9:34

Which programming language are you talking about?

Name: Anonymous 2009-03-29 9:37

>>1
The point is:
1) You cannot write it more efficiently in five minutes.
2) You're a tard.

Name: Anonymous 2009-03-29 10:12

>>2
STL?

Name: Anonymous 2009-03-29 19:10

>>1
Java SE shared system class library.
10,169 Files, 754 Folders
Size 105MB
Size on Disk 127MB
javac LineCounter.java
java LineCounter
Total Lines of code: 3011022
javac LineCounter.java
java LineCounter
Total Lines of code excluding comments: 1368846

If you want to go and write a standard library that large be my guest, although I think we all know you were trolling.

Linecounter is included below for convenience, and simply counts the total source lines of code in the java class libraries (NB: all libraries including system specific ones, because it differentiates between the actual library files and random .c and .html junk etc). You will need to change "basePath" to the location of the java class files if you wish to verify this yourself. The comment excluder is extremely naive and probably makes a few mistakes but I consider it to be within a reasonable margin of error.

import java.util.*;
import java.io.*;
public class LineCounter {
    private static final String basePath = "C:\\j2se\\src\\share\\classes";
    private static final boolean filterComments = false;
    private static BufferedReader br;
    public static void main(String[] args) throws IOException {
        File root = new File(basePath);
        System.out.println("Total Lines of code: "+recursiveReadDir(root.listFiles()));
    }
    private static int recursiveReadDir(File[] files) throws IOException {
        int locCount = 0;
        for(int i=0; i<files.length; i++) {
            if(files[i].isDirectory()) {
                System.out.println(files[i]);
                locCount+=recursiveReadDir(files[i].listFiles());
            }
            else {
                locCount+=FileLOC(files[i]);
            }
        }
        return locCount;
    }
    private static int FileLOC(File location) throws IOException {
        br = new BufferedReader(new FileReader(location));
        int count = 0;
        int index = 0, index2 = 0;
        String line = "";
        boolean inComment = false;
        while((line=br.readLine())!=null) {
            if(filterComments) {
                if((index=line.indexOf("/*"))>=0) inComment = true;
                index2 = line.indexOf("*/");
                if(index2>=0 && index2>=index) inComment = false;
            }
            if(!inComment) {
                line=line.trim();
                if(filterComments) if(line.length()<=2 || line.charAt(0)=='/' && line.charAt(1)=='/') continue;
                count++;
            }
        }
        br.close();
        return count;
    }
}

Name: Anonymous 2009-03-29 23:17

>>5
Linecounter
Why would I write a shitty program when one is already provided by POSIX?

Please use a real operating system.

Name: Anonymous 2009-03-30 2:33

>>6
Because you cannot exclude comments. Nice try though.

Name: Anonymous 2009-03-30 4:40

>>7
Piping through grep or awk is too hard for you?

Name: Anonymous 2009-03-30 5:54

>>5
is a great example of how ENTERPRISE SOLUTIONS really amount to 3 line shell scripts.

Name: Anonymous 2009-03-30 6:27

because good programmers are lazy and uncreative

Name: Anonymous 2009-03-30 7:03

IM STANDARD LIBRARY WTF
YOU CANT USE REVERSE
YOU CANT USE LENGTH
I DEFINE THOSE!!

Name: Anonymous 2009-03-30 7:26

>>8
Please show me how you pipe through grep or awk to strip /* */ multiline comments

Name: Anonymous 2009-03-30 8:46

Name: Anonymous 2009-03-30 9:34

>>12
Not to mention your code is completely fucking broken:


class Main {
    public static void main(String[] args) {
        String asd = "/*";
        System.out.writeLn("hax my anus");
    }
}

Name: Anonymous 2010-11-27 20:23

Name: Anonymous 2010-12-17 1:32

Xarn is a bad boyfriend

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