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

Pages: 1-4041-

The C++

Name: Anonymous 2010-11-10 12:42

ENTERPRISE C++ uses templates and ambigious function names for EVERYTHING.


#include <iostream>
#include <vector>
#include <cstdio>

template<typename s_t> void _sv(s_t&_s,const s_t&_i){_s=static_cast<s_t>(_i);}
template<typename t_1> bool _isl(t_1&_1,t_1&_2){return(_1<_2);}
template<typename t_1>bool _ise(t_1&_1,const t_1&_2){return(_1==_2);}
template<typename t_1>void _ic(t_1&s,const t_1&v){(s=s+v);}
template<typename a_t>class c_1:public std::vector<a_t>{};
template<typename a_t, typename b_t> class _a{
    a_t a;
    a_t _1_i;
    b_t b;
    char* _c;
    c_1<std::string> _rs;
    public:
        _a(a_t _a, b_t _b): a(_a), b(_b)
        {
            int _h_i;
            _1_i=0;
            if(_ise(a,1)) goto _L0;
            for(_sv(_h_i,1);_isl(_h_i,a);_ic(_h_i,1))
            {
                _c=b[_h_i];
                _rs.push_back(_c);
            }
            _1_n(); return;
            _L0: printf("go cry in a corner\n");
        }
        void _1_n()
        {
            std::string _1_s;
            typename c_1<std::string>::iterator _hi;
            _hi=_rs.begin();
            _L1: if(_hi==_rs.end())return;
            _1_s=*_hi;
            printf("argv[%d] = %s\n", _1_i, _1_s.c_str());
            _hi++; _1_i++; goto _L1;
        }
};

int main(int a, char** b)
{
    _a<int,char**>(a,b);
}

Name: Anonymous 2010-11-10 12:46

Also, for the Java douchebags who fail at reading ENTERPRISE C++, it prints commandline arguments.

Because I suppose /prog/ uses THE LUNIX.

Name: Anonymous 2010-11-10 12:51

>>2

I use Plan 9.

Name: Anonymous 2010-11-10 12:57

>>2
Because I suppose /prog/ uses GNU/linux.

Fixed. And you should too. Idiot GUI using monkeys can go to Reddit.

Name: Anonymous 2010-11-10 13:13

>>1
Looks like FrozenVoid started doing Sepples.

Name: Anonymous 2010-11-10 13:36

>>4
Idiot GUI using monkeys

You mean, those who aren't blind, and enjoy getting shit done?

Name: Anonymous 2010-11-10 13:38

>>6
This is what GUI using monkeys actually believe.

Name: Anonymous 2010-11-10 13:46

>>6
The only shit that get's done with you is the shit your mother took on your face.

Name: Anonymous 2010-11-10 14:18

>>1
template<typename s_t> void _sv(s_t&_s,const s_t&_i){_s=static_cast<s_t>(_i);}

isn't the static_cast redundant? _i is already an s_t because of const s_t&_i

Name: Anonymous 2010-11-10 14:23

>>1
write an entry level C++ code to print command line arguments
refactor everything to be a template
obfuscate all names
mfw you think you're a genius

Name: Anonymous 2010-11-10 14:26

>>10
your mum must be so proud of you

Name: Anonymous 2010-11-10 14:32

Name: Anonymous 2010-11-10 14:47

what what in the butt

Name: Anonymous 2010-11-10 14:53

>>9
templates for everything.

Name: Anonymous 2010-11-10 15:26

>>1
Enterprise? You've got it backwards: enterprise has identifier names no shorter than 15 characters. What you have there is the proper Open Source style.

Name: Anonymous 2010-11-10 16:51

>>15
It's Enterprise style with Open Source style naming convention.

Name: Anonymous 2010-11-10 17:42

Enterprise Open Source

Name: Anonymous 2010-11-10 21:00

>>9
It probably isn't completely superfluous.


i is a const reference to a s_t. The static_cast doesn't (and can't) mess with the constness, but I believe it casts away the reference so it may be assigned to the other reference without reference aliasing (a term I just made up based on pointer aliasing). Of course, it could also be completely superfluous, I'm not going to bother putting the code into a compiler to see.

Name: Anonymous 2010-11-11 0:02

>> 1
goto

Just look at youtself. This is not ENTERPRISE C++. This is simple shit. Remove goto to get ENTERPRISE quality shit

>>10
mfw

I'm sorry to inform you, but you need to get back to imageboards now, ``jew''. You're not welcomed here anymore.

Name: Anonymous 2010-11-11 6:13

>>19
ENTERPRISE C++ doesn't need no foolish for() or while() constructs.

prease2lernenterprise sir

Name: Anonymous 2010-11-11 6:42

>>20
Learn 2 sage, ``liberal''

Also don't confuse ENTERPRISE C++ and ENTERPRISE VB6. VB6 is too good to be confused with C++.

Name: Anonymous 2010-11-11 7:11

>>21
oh yeah? bump

Name: Anonymous 2010-11-11 8:55

>>21
VB6

Name: Anonymous 2010-11-11 16:27

>mfw NO FUCKING CODE COMMENTS

Name: Anonymous 2010-11-11 16:35

>>21

>VB
>good

MAXIMUM TROLLING

Name: Anonymous 2010-11-11 16:45

>>24,25
>mfw
>VB
>good
MAXIMUM TROLLING


Go back to /b/

Name: Anonymous 2010-11-11 16:47

>>26
QUOTING FAILURE DETECTED

Name: Anonymous 2010-11-11 16:51

>>21
VB
good


( ≖‿≖)

Name: Anonymous 2010-11-11 16:53

>>27
I separated two different quotes. And I have bitch tits.

Name: Anonymous 2010-11-12 21:02

C++ makes RAII possible. C makes RAII impossible. C++ strikes again!

Name: 2010-11-12 21:10

>>30
myobj_destroy(struct myobj *this);

Name: Anonymous 2010-11-12 21:48

>>31
prease2learnRAII, ``Nameless Faggot''

Name: Anonymous 2010-11-12 21:48

>>31 simple function does not help.You still need to call it manually. Have a nice day in function with several returns.

Name: Anonymous 2010-11-12 21:57

>>33
>>32
ya'll just mad because you don't have the logic and thinking process required by See.

Name: Anonymous 2010-11-12 21:59

>>31
In C++, the destructor is called as soon as the object goes out of scope.

In C, the destructor is never called as soon as the object goes out of scope, because
   1: C doesn't have a scope in the same meaning as in C++;
   2: Structs in C don't have destructors, which makes scopes already void and useless;
   3: you have to call myobj_destroy manually, which also makes 1 and 2 void and useless.

For example:

#include <cstdio>

class File {
    private:
        FILE* handle;

    public:
        File(const char* path)
        {
            handle = fopen(path, "w");
        }

        ~File()
        {
            close();
        }

        void close()
        {
            fclose(handle);
        }

        void write(const char* data)
        {
            fputs(data, handle);
        }
};

int main()
{
    File poop("things.txt");
    poop.write("hi");
    // no need to call 'poop.close()', as close() is called as soon as
    // poop goes out of scope
}


And now in C:
there is no C example, since C makes RAII impossible. it would be just the same with FILE* fopen(const char*, const char*) and void fclose(FILE*), without actually being able to call fclose upon destruction, as there is no such thing as ``destruction'', as in C++.

Name: Anonymous 2010-11-12 22:01

god forbid you to write one extra line to destroy a struct

Name: Anonymous 2010-11-12 23:08

>>36
Now that makes sense.

And by the way, my dear >>35:
1. A scope is a scope, the context where some variable live. C have one.
2. C structs are POD, you can't have methods in a struct, is not a fucking nerfed class like in C++, this doesn't mean that scope is ``void and useless''.
3. Because your little poor fingers hurts when you have to type just one little fucking function at the end of the scope.

You have a strange concept of scope, look at this code:

{ /* begin of the scope */
  int i; /* C automatically allocates i on the stack */
  struct astruct *s; /* C automatically allocates a pointer to ``astruct'' on the stack */
  struct anotherstruct s2;
  astruct_init(s); /* We manually call the constructor */
  anotherstruct_init(&s2);
  /* do some stuff */
  anotherstruct_destroy(&s2);
  astruct_destroy(s); /* OH MY GOD WE ARE CALLING THE DESTRUCTOR MANUALLY PLEASE KILL ME I'VE DISONORED MY FAMILY I WANT TO DIE */
} /* end of the scope, C automatically destroys i, s (the pointer) and the struct s2. */


Sure, it doesn't mean you can do RAII in C, but "C can't do RAII" and "C doesn't have a scope" are two different things.

If you can't remember what you have to deallocate at the end of a scope, go back to your C++.

You're now destroying your structures manually

Name: Anonymous 2010-11-12 23:12

>>37
Sure, it doesn't mean you can do RAII in C

I'm glad you're finally admitting it.

Name: Anonymous 2010-11-12 23:20

>>38
Yeah.
poster_destroy(>>38);
}

Name: Anonymous 2010-11-13 6:37

An important point is being glossed over. C++ destructors can be called automatically when an exception is thrown. You can turn several calls to free() within pseudo exception blocks into automatic destruction when exceptions are thrown.

Name: Anonymous 2010-11-13 10:42

>> C structs are POD, you can't have methods in a struct, is not a fucking nerfed class like in C++

I find ignorant retards fascinating. Would you kindly provide me with an insight about which exactly half-formed parodies of thoughts were unnaturally fornicating inside the thickness of your skull when you called C++ structs "nerfed classes"?

I mean, when I try to pretend that I don't know anything about C++ structs at all, and fantasize about how they could be different from classes, well, I can come up with a few funny ideas, like they don't allow inheritance or virtual methods, but I'd better hear it from an authentic idiot, if you would be so kind.

Name: Anonymous 2010-11-13 11:47

>>41
Tell me, what's the point for a struct to have methods?
Structs' purpose is to contain data.

Name: Anonymous 2010-11-13 12:04

>>40
    An important point is being glossed over. C++ destructors can be called automatically when an exception is thrown


void foo()
{
atexit(function_that_closes_my_file);
}

void bar()
{
 perror("EXCEPTION! OP is NOT a FAGGOT!");
 exit(1); //calls destructor
}


where's your RAII god now?

>> 42
Structs' purpose is to contain data.
IHBT. Structs' puropos is to STRUCTURISE data.

Name: Anonymous 2010-11-13 12:21

>>43
You're still calling exit(), that's not RAII!

Name: Anonymous 2010-11-13 13:13

>>43

That is not the same thing at all. Think about throwing an exception from within several nested function and method calls. Closing a file is nothing, freeing memory for n objects is something.

Name: Anonymous 2010-11-13 13:16

>>45
ATEXIT(3)                  Linux Programmer's Manual                 ATEXIT(3)



NAME
       atexit - register a function to be called at normal process termination

SYNOPSIS
       #include <stdlib.h>

       int atexit(void (*function)(void));

DESCRIPTION
       The atexit() function registers the given function to be called at nor‐
       mal process termination, either via exit(3) or via return from the pro‐
       gram's main().  Functions so registered are called in the reverse order
       of their registration; no arguments are passed.

       The same function may be registered multiple times: it is  called  once
       for each registration.

       POSIX.1-2001  requires that an implementation allow at least ATEXIT_MAX
       (32) such functions to be registered.  The actual limit supported by an
       implementation can be obtained using sysconf(3).

       When  a child process is created via fork(2), it inherits copies of its
       parent's registrations.  Upon a successful call to one of  the  exec(3)
       functions, all registrations are removed.

RETURN VALUE
       The  atexit()  function returns the value 0 if successful; otherwise it
       returns a nonzero value.

CONFORMING TO
       SVr4, 4.3BSD, C89, C99, POSIX.1-2001.

NOTES
       Functions registered using atexit() (and on_exit(3)) are not called  if
       a process terminates abnormally because of the delivery of a signal.

       If  one  of the functions registered functions calls _exit(2), then any
       remaining functions are not invoked, and the other process  termination
       steps performed by exit(3) are not performed.

       POSIX.1-2001  says  that  the  result of calling exit(3) more than once
       (i.e., calling exit(3) within a function registered using atexit())  is
       undefined.   On  some  systems  (but  not Linux), this can result in an
       infinite recursion; portable programs should not invoke exit(3)  inside
       a function registered using atexit().

       The  atexit()  and  on_exit(3) functions register functions on the same
       list: at normal  process  termination,  the  registered  functions  are
       invoked in reverse order of their registration by these two functions.

       POSIX.1-2001 says that the result is undefined if longjmp(3) is used to
       terminate execution of one of the functions registered atexit().

   Linux Notes
       Since glibc 2.2.3, atexit() (and  on_exit(3))  can  be  used  within  a
       shared  library  to establish functions that are called when the shared
       library is unloaded.

EXAMPLE
       #include <stdio.h>
       #include <stdlib.h>
       #include <unistd.h>

       void
       bye(void)
       {
           printf("That was all, folks\n");
       }

       int
       main(void)
       {
           long a;
           int i;

           a = sysconf(_SC_ATEXIT_MAX);
           printf("ATEXIT_MAX = %ld\n", a);

           i = atexit(bye);
           if (i != 0) {
               fprintf(stderr, "cannot set exit function\n");
               exit(EXIT_FAILURE);
           }

           exit(EXIT_SUCCESS);
       }

SEE ALSO
       _exit(2), exit(3), on_exit(3)

COLOPHON
       This page is part of release 3.30 of the Linux  man-pages  project.   A
       description  of  the project, and information about reporting bugs, can
       be found at http://www.kernel.org/doc/man-pages/.



Linux                             2008-12-05                         ATEXIT(3)

Name: Anonymous 2010-11-13 13:26

>>46
Yes, you can copy and paste the man page for atexit(). That doesn't make it magically aware of objects created within function scopes, it just makes you an ignorant asshole.

Name: Anonymous 2010-11-13 14:18

>>47
Consider this: your a faggot.

Name: Anonymous 2010-11-13 14:21

>>42
Are you the same retard as >>37 ?

No one cares about your notions of the "purpose" of structs.

In C++ a struct is a class with an implicit public: in the beginning. Or, in other words, a class is a struct with an implicit private: in the beginning. No more differences. Nothing is "nerfed". You can take your fantasies about arbitrary unnecessary restrictions and stuff them in your FIOC.

Name: Anonymous 2010-11-13 14:50

>>49
unnecessary restrictions
Like the need of explicitly casting from/to void*?

Name: Anonymous 2010-11-15 12:45

THREADSURRECTION

Name: Anonymous 2010-11-19 17:48

>>48
What about MY a faggot?

Name: Anonymous 2010-11-19 19:24

>>52
Your it.

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