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

Pages: 1-4041-

Gay OO argh

Name: Anonymous 2009-11-11 7:03

I suppose I better learn one of them gay OO business oriented to be able to code inane custom apps for some corporate...

I come from the C demoscene school, so using OO and especially using stuff like .NET or JVM to me is like pulling my eyes out with a spoon; but the world changes nobody cares about pure performance anymore it seems. I gotta go with the flow...

So, which is the lesser of two evils for someone like me?
C# or Java?
(or any other you might suggest)

Name: Anonymous 2009-11-11 7:17

Smalltalk

Name: Anonymous 2009-11-11 7:18

C#|.NET is about anal slavery
Java is about LOC
C is about premature bitfucking
groovy is about whatever
slojure is about awesome

Name: Anonymous 2009-11-11 7:23

If you're anything like me you'll probably like java better, OP.

Name: Anonymous 2009-11-11 7:27

If you're anything like a competent programmer, you'll prefer C# to Java but nearly anything else to either.
Since you sound like kind of an idiot, try Java.

Name: Anonymous 2009-11-11 7:39

>>5
is it seforples fucktard with his baseless statements again?

Name: Anonymous 2009-11-11 7:43

I didn't cut it in the C demoscene school
ftfy

Name: Anonymous 2009-11-11 8:07

why does the demoscene even exists?
there's bound to be much better, easier, more effective ways to do it.

Name: Anonymous 2009-11-11 8:18

Smalltalk/any language with a CLOS.

maybe Scratch is for you

Name: Anonymous 2009-11-11 8:19

>>6
Maybe you should learn to read.

Name: Anonymous 2009-11-11 8:24

>>9
I agree. Having read AMOP, I wasn't able to grasp why the fuck sepples and java tards think their languages are object oriented.

Name: Anonymous 2009-11-11 9:18

>>1
OO always sacrifices performance
( ≖‿≖)

Name: Anonymous 2009-11-11 9:22

>>12
Functions sacrifice performance too.
Everything should be done with GOTO's.

Name: Anonymous 2009-11-11 9:28

>>13
Without function prolog and ending, function calls would perform exactly the same as goto statements. Which makes me wonder, why do compilers still bother to save the registers, move the base pointer and so forth if they could just do away with it completely. It's not like anyone's still writing custom assembly to mess up the registers.

Name: Anonymous 2009-11-11 9:34

>>14
I don't think you have fully thought what just said through.

Name: Anonymous 2009-11-11 9:35

>>14
The same some reason people think function calls should always return to the caller, tradition and lack of imagination

Name: Anonymous 2009-11-11 9:38

>>16
Functions returning to a random point in the code segment would be pretty awesome for most purposes.

Name: Anonymous 2009-11-11 9:38

>>16
So how should it be done?

Name: Anonymous 2009-11-11 9:44

>>18
Can't you let me troll in peace?

Name: Anonymous 2009-11-11 9:51

>>19
Trolls should at least make some sense to work properly. Thus, it is you who is depriving yourself of peace while you troll.

Name: Anonymous 2009-11-11 11:53

>>17
I personally would like to return to another process somewhere, with CoW.

>>1
Without further qualifying factors, I would suggest C#. On the other hand, embedded programming is kind of a big deal and Android uses a less terrible than most Java implementation. (If you're just looking to branch out, get into embedded stuff. Though I'd personally avoid Android.)

Kudos on being a C dude. I feel your pain buddy.

Name: Anonymous 2009-11-11 11:59

>>9
This. CLOS is pretty nice for OO, but OP seems to want something liked by the ENTERPRISE, so I'd go with C#, but Java isn't that much different from it.

Name: Anonymous 2009-11-11 12:29

>>11
I don't know enough about Ambient-Orientation to argue your statement.

>>16
The program is just chilling, running normally, when suddenly a 42 appears somewhere and it doesn't know what the heck.

Name: Anonymous 2009-11-11 12:40

>>23
Except for the whole "tied to MS" thing. Maybe.

Name: Anonymous 2009-11-11 14:22

>>8
How is babby formed?

Name: Anonymous 2009-11-11 14:25

The answer is Common LISP

Name: Anonymous 2009-11-11 14:26

>>27
It always is. But unfortunately, you can't use toy languages for making monies.

Name: Anonymous 2009-11-11 14:30

>>24
oh god how did that get there i'm not good with computer

Name: Anonymous 2009-11-11 14:39

>>29
I'm 12 and what is this?

Name: Anonymous 2009-11-11 14:42

>>30
Go write a compiler or something.

Name: Anonymous 2009-11-11 18:43

Learn COBOL and become an ENTERPRISE GOD

Name: Anonymous 2009-11-12 1:57

I hate dealing with code written by people like OP.  The faggots who name all their variables like cryptic registers and document nothing.  They have huge swaths of copy and pasted code from their "performance tweaking", a lot of it commented out so they can revert to other implementations later if necessary (they just don't want to delete it).  Nearly all their functions are declared inline.

I have to go over your shit code, turn it into something manageable by multiple people (there's OOP for you), and then document your shit.

You can always spot poor programmers pretty quickly.  They are tied to a particular language.  They hate one or more languages.  Why?  They don't understand it.  They assume what they know is superior.

Go suck some cocks, man. Suck a mean fat one.

Name: Anonymous 2009-11-12 9:43

>>33
I lol'd, though I must ask you this: do you really think people hate PHP adn Java because they don't understand them? I'll leave Sepples out because it's possible that no one understands it.

Name: Anonymous 2009-11-12 10:22

>>34
Also, how can one hate Java? I understand if someone does not like it, but why such hard feelings? It isn't even nearly as fucked up as PHP is.

Name: Anonymous 2009-11-12 10:38

>>35
OutputStream s = new BufferedOutputStream(new FileOutputStream(new File("asd")));

It's almost like I'm really writing LISP.

Name: Anonymous 2009-11-12 10:46

>>17
Considered harmful.

Name: Anonymous 2009-11-12 12:28

OutputStream s = (new BufferedOutputStream
                      (new FileOutputStream
                           (new File
                                ("asd"))));

HOLY FUCK !

I'm giving up LISP for JAVA so I can write ENTERPRISE SOLUTIONS to ENTERPRISE PROBLEMS using ENTERPRISE GRADE ALMOST-LISP!

It's going to be Great!

Name: Anonymous 2009-11-12 13:05

>>38 nice one, now how about some WITH-OPEN-FILE/STREAM macro to go with that?

Name: Anonymous 2009-11-12 13:12


#include <stdio.h>
int main
(
  int argc, char **argv
)
{ if
  (
    (
      (
        (
          (
            (
              (
                argv[1] )))))))
              { printf
                (
                  "%s\n", argv[1] );
                return 0; } return 1; }

Name: Anonymous 2009-11-12 13:15

>>36
FILE*fp=fopen("asd","w");
Saves a lot of memory too.

Name: Anonymous 2009-11-12 13:26

>>36
Yes, that's bloated shit, but at least it's not fucked up beyond any repair shit.

Name: Anonymous 2009-11-12 13:32

>>38
EXPERT LISP-style Java programmer.

Name: Anonymous 2009-11-12 13:34

>>40
Please return to /FV/

Name: Anonymous 2009-11-12 13:35

>>38
I LOVE YOU! I LOVE YOUR POST! I READ IT 5 TIMES! KEEP POSTING!

Name: nullpointer 2009-11-12 17:48

>>36

lol evidently you've never coded LISP. (not (= LISP many-parens)). That's just the visual aspect which anybody and their dog can spot in a snippet of code. LISP is about far more than the visual look of its syntax. It's more about the way it parses and handles that syntax. Just because both java and LISP use the '(' character in their source code does not bring them any closer together.

Also, I'm looking forward to a future where computers are so powerful you can get away with coding LISP as a reasonable systems language. (That is if we don't descend into medieval anarchy and club each other's brains out over the last remaining foodscraps)

Name: Anonymous 2009-11-12 17:54

>>41
Use a modern systems language fer chrissake.

package main

import "bufio"
import "os"

const errorPrefix = "\033[41m\033[37m\033[1m\033[5mCRITICAL FAILURE: "
const errorSuffix = "\033[m\n"

func reportError(err os.Error) {
    os.Stderr.WriteString(errorPrefix + err.String() + errorSuffix)
}

func main() {
    f, err := os.Open("asd", os.O_WRONLY|os.O_CREAT|os.O_TRUNC, 0666);
    if err != nil {
        goto fail    // the mighty gofumpt insists this is a 3-line block
    }
    s := bufio.NewWriter(f);
    // no need to worry about out-of-memory,
    // since Go unconditionally crashes in that case.
    err = s.WriteString("blah");
    if err != nil {
        goto fail
    }
    err = s.Flush();
    if err != nil {
        goto fail
    }
    return;
fail:
    reportError(err);
}

Name: Anonymous 2009-11-12 18:01

>>46
Dude was joking, chump.

Name: Anonymous 2009-11-12 18:13

HAXHAXHAXHAXMYANUSANUSANUSANUS

Name: Anonymous 2009-11-12 18:37

>>47
goto <3

Name: Anonymous 2009-11-12 19:01

why do lispfags try to turn every thread into a thread about their toy language?
does lisp cause you some kind of brain damage or something?

Name: Anonymous 2009-11-12 19:27

>>50
I originally wrote an ridiculous chain of if-else blocks, assuming Go was too hip to goto.  But I didn't want to be too harsh, so I checked the spec and it was there, with error handling as the implied purpose.

edit: it seems I broke the rules, though, since the first goto skips across a variable declaration.  Which means I would need an explicit var s bufio.Writer; before that.

Also you can finally use break and continue with label parameters to jump more than one block out.

Name: Anonymous 2009-11-12 19:27

>>51
Read SICP, then you'll UNDERSTAND

Name: Anonymous 2009-11-12 19:41

>>51
It's because you haven't read SICP

Name: Anonymous 2009-11-12 21:01

C++ you fucktards

Name: Anonymous 2009-11-12 23:18

C++ if you're anal
Java if you're insane

Name: Anonymous 2009-11-12 23:49

>>36
FileWriter fw = new FileWriter(new File("asd"));

Name: Anonymous 2009-11-13 2:12

>>1
Question. How does one get into the demoscene?

Name: Anonymous 2009-11-13 6:13

>>33
this is for you my love


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include <SDL/SDL.h>
#include <SDL/SDL_opengl.h>

#define DEFAULT_XRES             1024
#define DEFAULT_YRES             768

#define MAX_CIRCLE_ANGLE        512
#define HALF_MAX_CIRCLE_ANGLE         (MAX_CIRCLE_ANGLE/2)
#define QUARTER_MAX_CIRCLE_ANGLE     (MAX_CIRCLE_ANGLE/4)
#define MASK_MAX_CIRCLE_ANGLE         (MAX_CIRCLE_ANGLE - 1)
#define PI                 3.14159265358979323846f

float fast_cossin_table[MAX_CIRCLE_ANGLE];

__inline__ float fastcos(float x) {
    int i;
    i = (int)(x * HALF_MAX_CIRCLE_ANGLE / PI);
       if (i < 0) {
        return fast_cossin_table[((-i) + QUARTER_MAX_CIRCLE_ANGLE)&MASK_MAX_CIRCLE_ANGLE];
    } else {
        return fast_cossin_table[(i + QUARTER_MAX_CIRCLE_ANGLE)&MASK_MAX_CIRCLE_ANGLE];
       }
    printf("0");
}

__inline__ float fastsin(float x) {
    int i;
    i = (int)(x * HALF_MAX_CIRCLE_ANGLE / PI);
       if (i < 0) {
              return fast_cossin_table[(-((-i)&MASK_MAX_CIRCLE_ANGLE)) + MAX_CIRCLE_ANGLE];
       } else {
              return fast_cossin_table[i&MASK_MAX_CIRCLE_ANGLE];
       }
}

void buildsincos(void) {
    int i;
    for (i = 0; i < MAX_CIRCLE_ANGLE; i++) {
        fast_cossin_table[i] = (float)sinf(i * PI / HALF_MAX_CIRCLE_ANGLE);
    }
}

SDL_Surface *screen;
int quit = 0;
SDL_Event event;

SDL_Surface *skull = NULL;
SDL_Surface *skull_tmp = NULL;
SDL_Surface *tmp = NULL;
SDL_Surface *wavy = NULL;

int floorLog2(unsigned int n) {
    int pos = 0;
    if (n >= 1<<16) { n >>= 16; pos += 16; }
    if (n >= 1<< 8) { n >>=  8; pos +=  8; }
    if (n >= 1<< 4) { n >>=  4; pos +=  4; }
    if (n >= 1<< 2) { n >>=  2; pos +=  2; }
    if (n >= 1<< 1) {           pos +=  1; }
    return ((n == 0) ? (-1) : pos);
}

SDL_Rect posTmp;
SDL_Rect clipTmp;
inline void mega_super_fast_blit_tmp(int x, int y, SDL_Surface *src, SDL_Surface *dest)
{
    posTmp.x = x;
    posTmp.y = y;
    clipTmp.x = x;
    SDL_BlitSurface(src, &clipTmp, dest, &posTmp);
}

SDL_Rect pos;
SDL_Rect clip;
inline void mega_super_fast_blit(int x, int y, SDL_Surface *src)
{
    pos.y = y;
    pos.x = x;
    clip.y = y;
    SDL_BlitSurface(src, &clip, wavy, &pos);
}

GLuint texture;
GLenum texture_format;
GLint nOfColors;

int main(int argc, char *args[]) {
    assert(SDL_Init(SDL_INIT_VIDEO) != -1);

    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);

    screen = SDL_SetVideoMode(DEFAULT_XRES, DEFAULT_YRES, 32, SDL_OPENGL);
    assert(screen != NULL);
    buildsincos();

    Uint32 colorkey;
    tmp = SDL_LoadBMP("back.bmp");
    assert(tmp != NULL);
    skull = SDL_DisplayFormat(tmp);
    skull_tmp = SDL_CreateRGBSurface(SDL_SWSURFACE, skull->w, skull->h, 32, 0, 0, 0, 0);
    wavy = SDL_CreateRGBSurface(SDL_SWSURFACE, skull->w, skull->h, 32, 0, 0, 0, 0);
    SDL_FreeSurface(tmp);

    SDL_WM_SetCaption("Powah", NULL);

    unsigned int skullw = skull->w;
    unsigned int skullh = skull->h;

    float jit = 0.0f;
    float jitstep = 0.16f;
    float amp = 4.0f;
    float z = 0.0f;
    float x = 0.0f;
    float y = 0.0f;

    unsigned int slice = 1;
    int sliceShift = floorLog2(slice);

    clipTmp.y = 0;
    clipTmp.w = slice;
    clipTmp.h = skullh;

    clip.x = 0;
    clip.w = skullw;
    clip.h = slice;

    int skullws = skullw>>sliceShift;
        int skullhs = skullh>>sliceShift;

    int bandTbl[1024];
    register unsigned int e;
    for (e = 0; e<1024; e++)
            bandTbl[e] = (e<<sliceShift);


    glEnable(GL_TEXTURE_2D);
    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

    glGenTextures(1, &texture);
    glBindTexture(GL_TEXTURE_2D, texture);

    // Set the texture's stretching properties
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
   
    while (quit == 0) {
        while (SDL_PollEvent(&event)) {
            if (event.type == SDL_QUIT) {
                quit = 1;
            }
            if (event.type = SDL_KEYDOWN) {
                switch (event.key.keysym.sym) {
                    case SDLK_LEFT:
                        z += 0.2f;
                    break;
                    case SDLK_RIGHT:
                        z -= 0.2f;
                    break;

                    default:
                    break;
                }
            }
        }

        //unsigned int band = 0;

        for(e = 0; e < skullws; e++) {
            mega_super_fast_blit_tmp(bandTbl[e], fastsin(jit)*amp, skull, skull_tmp);
            jit += jitstep;
        }
        for(e = 0; e < skullhs; e++) {
            mega_super_fast_blit(fastcos(jit)*amp, bandTbl[e], skull_tmp);
            jit -= jitstep;
        }

        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        glClearDepth(1.0f);                            // Depth Buffer Setup
        glEnable(GL_DEPTH_TEST);                        // Enables Depth Testing
        glDepthFunc(GL_LEQUAL);   
        glViewport(0, 0, DEFAULT_XRES, DEFAULT_YRES);
        gluPerspective(45.0f, (GLfloat)DEFAULT_XRES/(GLfloat)DEFAULT_YRES, 0.1f, 100.0f);
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glLoadIdentity();
        gluLookAt(0, 0, z, 0, 0, 0, 0, 1, 0);
        glBindTexture(GL_TEXTURE_2D, texture);
        glTexImage2D(GL_TEXTURE_2D, 0, 4, wavy->w, wavy->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, wavy->pixels);

        glBegin(GL_QUADS);
            glTexCoord2i(0, 0);
            glVertex3f(1.0f, 1.0f, 0.0f);
   
            //Bottom-left vertex (corner)
            glTexCoord2i(1, 0);
            glVertex3f(-1.0f, 1.0f, -5.0f);
   
            //Bottom-right vertex (corner)
            glTexCoord2i(1, 1);
            glVertex3f(-1.0f, -1.0f, -5.0f);
   
            //Top-right vertex (corner)
            glTexCoord2i(0, 1);
            glVertex3f(1.0f, -1.0f, 0.0f);
        glEnd();

        SDL_GL_SwapBuffers();
        SDL_Delay(15);
    }
    SDL_FreeSurface(skull);
    SDL_FreeSurface(wavy);
    SDL_FreeSurface(skull_tmp);
    SDL_Quit();
    return 0;
}

Name: Anonymous 2009-11-13 6:44

>>58
You have to be able to write something like this:
http://www.youtube.com/watch?v=5PZ73nLZaqc

Name: Anonymous 2009-11-13 6:50

Name: Anonymous 2009-11-13 7:30

>>59
assert failed because I have no back.bmp.  What is it supposed to be?

Name: Anonymous 2009-11-13 8:01

>>62
it's a picture of someone's back

Name: Anonymous 2009-11-13 10:19

>>59
I don't know why that code makes me feel nostalgic.

Name: Anonymous 2009-11-13 18:05

>>61
The executable version of this is a 26 mb download. It makes a nice video and all, but it's not very impressive from a technical standpoint.

>>60
Suppose I've written something like this. Now what do I do? OP, how did you get into the demoscene?

Name: Anonymous 2009-11-13 18:13

>>59
Built this and put in a 512x512 checkerboard image for back.bmp. I get a black screen. What am I doing wrong? Also, where does this code come from?

Name: Anonymous 2009-11-13 18:43

>>66
Press the left arrow key to move backwards from this huge ass red rectangle.  You can use the right arrow keys to move further towards it.

Name: Anonymous 2009-11-13 18:47

>>26
mitosis

Name: Anonymous 2009-11-13 21:35

Name: Anonymous 2009-11-14 0:10

>>67
There's no rectangle. Just black.

Name: Anonymous 2011-02-03 1:35

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