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

What will this output?

Name: Anonymous 2016-06-19 12:21

What will this program output?
Good luck, you'll need it!

#include <iostream>
using namespace std;

int main() {
class c {
public:
c() {
void f();
f();
}
};

c my_c();
}

void f() {
cout << "VALID C++" << endl;
}


The answer is absolutely nothing because c my_c(); is a fucking function declaration.

Name: Anonymous 2016-07-11 15:46

>>38,39
Regardless, doesn't multithreading have no effect on efficiency class in most situations, since the number of threads is finite and thus increases speed by at most a constant multiple for a given input?

Name: Anonymous 2016-07-11 19:30

>>41
All computer resources are finite, dumbass.

Name: Anonymous 2016-07-11 20:29

>>42
So do you think C++ isn't Turing complete then? A real Turing machine has unbounded memory, since what distinguishes it from other models of computation is that it has an infinite number of possible states.

Name: Anonymous 2016-07-11 20:34

Distinguish these dubs

Name: Anonymous 2016-07-11 21:57

>>43
What a load of utter fuckheads. You in particular, shit-for-brains, don't know the different between Turing Complete and a Turing Machine.

Everybody who's posted in this thread, except me, must be killed.

Name: Anonymous 2016-07-11 22:11

Check em

Name: Anonymous 2016-07-11 22:14

Check em

Name: Anonymous 2016-07-11 22:59

>>45
Turing complete means able to simulate any single-taped Turing machine. And I was memeing, C++ actually IS Turing complete because the language itself places no limit on the available memory. But the language specification is just a theoretical ideal, any actual implementation of the language will not be truly Turing complete because the hardware limits available memory. You can write code in C++ to simulate a universal Turing machine, but there will always be some Turing machine that is impossible to simulate because there isn't enough memory. Some Turing machines actually do require infinite memory (though these are by definition non-halting, but not all non-halting TM's require infinite memory), and since the largest positive number less than infinity is unbounded, for any physical computer there will exist some halting Turing machine which it does not have sufficient memory to simulate.

Name: Anonymous 2016-07-11 23:00

>>46
>>47
Are you even trying?

Name: Anonymous 2016-07-12 2:43

>>48
Because I/O exists, the size limitations of memory have nothing to do with simulating a Turing machine. Do you faggots even fucking think?

Name: Anonymous 2016-07-12 3:04

>>50
What does I/O have to do with it? Are you talking about writing to removable disks and using that as your "infinite memory"? Even if you are, the total number of removable disks available to write to is still finite. Even if we could use the entire universe as our data storage medium at say 1 exabyte per atom, there are still some Turing machines that we'd be unable to simulate.

Name: Anonymous 2016-07-12 4:01

>>50,51
For all practical purposes, we don't need any system to implement the "infinite tape" part of the universal Turing machine. Such machines are still considered Turing complete.

Name: Anonymous 2016-07-12 4:23

>>52
No actual Turing complete computational device has ever been created. Turing completeness is really only meaningful to measure the expressiveness of languages. Saying a language is Turing complete means the set of algorithms it can describe is at least equal to the set of algorithms that can be executed by a Turing machine. But there are some such algorithms that cannot be executed on any real computer.

Name: Anonymous 2016-07-12 20:43

>>53
But there are some such algorithms that cannot be executed on any real computer.

Name one.

Name: Anonymous 2016-07-12 21:06

>>55
Travelling salesman.

Name: Anonymous 2016-07-13 0:30

>>54
Outputting an infinite list of 1's.

Name: Anonymous 2016-07-13 1:35

>>55

Some traveling salesman problems can be solved by a computer, but no physical computer is TS-complete (i.e. able to solve any arbitrary version of the traveling salesman problem). This is because, for any given algorithm, as the number of cities approaches infinity, so does the memory required. Of course, some algorithms are more memory-efficient than others, but even so, eventually the input alone will exceed available memory.

However, generally speaking the TSP is viewed as time-limited, not memory-limited. Pretty much ANY problem will require infinite memory as input size goes to infinity, so TSP doesn't really stand out in that regard. Where it does stand out is in having O(n!) time efficiency for the brute force case.

Name: Anonymous 2016-07-13 7:26

All threads will be replied to.

Name: Anonymous 2016-07-13 13:34

>>58

NO EXCEPTIONS

Name: Anonymous 2016-07-13 13:48

>>56
while(1){
output(1);
}

Name: Anonymous 2016-07-13 14:52

>>60
Any real computer will run out of memory to store all those 1's eventually. The LANGUAGE is Turing complete (since it can describe any algorithm that can run on a Turing machine), but no hardware truly is.

Name: Anonymous 2016-07-13 17:48

>>61
Pipe it to /dev/null. Infinite 1 generation achieved.

Name: Anonymous 2016-07-13 21:28

>>62
But that means you can't actually get the entire output. That's like saying
#include <string>
int main() {
string aString = "Hello World!";
return 0;
}

is a valid Hello World program.

Name: Anonymous 2016-07-13 22:32

>>63
You can't get the output of lambda terms either, but lambda calculus is respected among the LGBT community.

Name: Anonymous 2016-07-13 23:22

>>19
Note that 'thread' doesn't necessarily mean thread in the operating system sense.
This is the general idea of how a good regex engine works though.

Name: Anonymous 2016-07-13 23:31

>>65
Obviously. Well, to everybody but Cudder, I guess.

Name: Anonymous 2016-07-13 23:31

>>23
Is reading to the end of the subject string required for regular expressions?

Not all of them but obviously yes for some you fucking moron.

Name: Anonymous 2016-07-14 3:14

>>65
But true multithreading is needed if you want it to run in better than linear time.

Name: Anonymous 2016-07-14 7:12

>>68
I don't think threading on reasonable consumer hardware would bring it down to less than linear time anyway.

Name: Cudder !cXCudderUE 2016-07-14 10:49

>>67
Completely missed the point "you fucking moron". So what? I don't see anyone complaining that matching regular expressions is hard...!

>>65
That's why "thread" is in quotes. Coroutines would be far better for this than actual threads.

>>68
It's not possible to be better than linear since the whole program needs to be parsed. Actual multithreading will at best improve performance by a constant factor.

Name: Anonymous 2016-07-14 13:17

>>70
Cudder give me your Kik, I want a chat with you.

Name: Anonymous 2016-07-14 18:14

Cudder loves nigger dick!

Name: Anonymous 2016-07-14 21:51

>>72
[citation needed]

Name: Anonymous 2016-07-14 22:21

>>73
Every post on this board from Cudder is citation enough that he craves the negro penis.

Name: Anonymous 2016-09-08 19:37

>>36
Are you seriously claiming that using multithreading means the parser doesn't run in linear time? That's like saying Hello World runs in O(n!) since the number of computers it can run on at once is unbounded.

>>54
The following program will run indefinitely on a Turing machine, but will terminate due to OOM on any real computer
int main(void) {
unsigned char *ptr;
while(1) {
ptr = malloc(sizeof(char));
*ptr = 255;
}
return 0;
}

Name: Anonymous 2016-09-08 20:39

but will terminate due to OOM on any real computer
This is wrong, ptr may either be garbage collected at the end of each loop, malloc may return null and you cause UB or the compiler may as well optimise it and only keep the while(1).
On shitty systems the program may be killed by OOM.

Name: Anonymous 2016-09-08 20:58

>>76
I chose C because it's not a garbage collected language, and I assumed use of a non-optimizing compiler. And yes, I'm aware that malloc returns null when OOM, however wouldn't assigning a value to a null pointer cause the program to crash?

Name: Anonymous 2016-10-28 2:35

What will this program output?

#include <stdio.h>

int squareprompt(void);

int x = squareprompt();

int main(void) {
puts("GOODBYE, CRUEL WORLD!");
return 0;
}

int squareprompt(void) {
int n, r;
input:
printf("PLEASE ENTER A POSITIVE INTEGER: ");
scanf("%d", &n);
if (n < 0) goto input;
r = n * n;
printf("SQUARE OF THE NUMBER YOU ENTERED IS %d.\n", r);
return r;
}

Name: Anonymous 2016-10-28 9:01

>>78 Intuitively i think it would be rejected since statics cannot inited from functions. This is the actual result: http://codepad.org/2gpwf0SQ

Name: Anonymous 2016-10-28 11:36

>>77
it's not a garbage collected language
The standard allows it to be.

and I assumed use of a non-optimizing compiler
You assume many things.

however wouldn't assigning a value to a null pointer cause the program to crash?
Its UB

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