« first day (645 days earlier)      last day (4304 days later) » 

12:03 PM
anything going on people?
 
not much
 
wow my internet is being weird
 
Now the code would compile but would cause Undefined Behavior if used (it returns a pointer to a temporary). The three incorrect technical claims are still there. And this answer still fails to answer the OP's question, the "why", i.e., there's a lot of incorrect claims, there's nonsense UB code, and there's no answer. — Cheers and hth. - Alf 26 secs ago
^ Needs more downvoting.
 
0
A: List vs Vector, remove an element while looping through

FredOverflowYes, in theory lists offer faster removal than vectors, but in practice, nobody uses lists. Why not? Because vectors generate much less heap activity, and they offer much better cache locality. Are you sure you absolutely need to loop over the vector and erase elements one by one? That would res...

 
ugh
look at this discoussion
0
A: logical AND and OR in c

Doug T.On the MSDN page for &&: The logical-AND operator produces the value 1 if both operands have nonzero values. Clearly both operands are -1 in your example so they will produce 1. On the same page, listed for || If either operand has a nonzero value, the result is 1. In your c...

 
12:13 PM
@FredOverflow You could as well fill a new vector with the to-be-removed items left out and then assign it to the original one.
Linear time.
 
swapping and copying has been mentioned. third, there is indirection, which is almost always a solution to any computer science problem. in this case, cursor gap.
the single reason for existence of std::list was that it could offer fast splicing. with c++11 it can't, any longer. so it's just a pimple on the standard library's ass, so to speak.
 
@Cheersandhth.-Alf: they removed splicing?
 
no, changed complexity requirements
lemme check
 
is there any "free" C11 spec? like some nearly done draft or something
(and why do these things cost money, it's so annoying =/)
 
Since when is chat 4chan?
 
12:21 PM
there is n3290, which is no longer free but is identical to the standard, and there is n3337, which includes some fixups after the standard
 
@RadekSlupik: how is that 4chan?
If you want me to fully Capitalize every sentence and end it with a semicolon (.), fine.
but when I'm chatting this feels much more comfortable
 
@nightcracker 4chan uses float: left for comments so after the first two comments they appear below the topic instead of next to it.
 
@RadekSlupik: see? I never visit the site :)
@RadekSlupik: it doesn't happen on my screen, though
@Cheersandhth.-Alf: that's C++
@Cheersandhth.-Alf: I asked for C11 ;)
 
@nightcracker probably was a glitch. I refreshed the page and the problem was gone.
 
12:28 PM
ah it goes all the way back to C++98. in C++98 size "should" have O(1) complexity. that precludes constant time splicing, because the elements must be counted.
pretty silly
 
I don't understand
 
oh yes, the change: in C++11 size must have O(1) complexity
 
how does size O(1) block constant time splicing?
oh wait a sec
nvm :)
 
@nightcracker in order to provide the size without counting the elements, the size must be stored somewhere. that means counting the elements as they're added.
 
yeah, and that count gets invalidated on the splice
which means you need to recount
which stops O(1) complexity
 
12:30 PM
yes
 
silly
oh well
every compiler I know tends to fuck the standard anyway
 
not for this :(
 
I'm going to write an iPhone app in Python.
 
no way it'll get accepted into the appstore :)
 
Why not?
 
12:41 PM
Because it's not in HOLY APPLE LANGUAGE.
 
^that
 
wtf
I couldn't type anything, had to refresh
oh well - morning Cat++
 
Apple also allows C# to be used, or whatever language you like.
Everything is fine as long as it doesn't execute code downloaded from the Internet.
 
Incredible.
It's almost like an open platform.
 
Is CPython even compiled on an iPhone
 
12:42 PM
You can compile python for ARM and it will run.
 
And they can't enforce the "don't execute code from the internet" with Python
too dynamic
 
Ell
can python compile to native code?
 
There is a Python IDE for iOS.
 
That's a bit of an annoying question
 
crap. It seems I lost my Apple dev ID.
 
12:43 PM
The short answer is no
 
It can be JITted just fine. Static compiling is more difficult, hence why RPython was created for that.
 
The long answer is "a bit"
for example, JIT
 
Who cares about static compiling in a highly dynamic language, anyway.
 
Personally I like Cython a lot
 
@Ell Take a look at PyPy.
 
Ell
12:44 PM
that's not really native though
 
What's not native?
 
@Ell: define native
 
If CPU bytecode is not native, then nothing is.
 
Hand-wired circuits.
 
And please don't tell me "a .exe is native"
 
12:45 PM
:P
 
I find editing annoying, isn't there some shortcut? Like double-clicking on your message
 
@nightcracker arrow-up-key.
 
Ell
I want to say code relying only on the CPU & OS, not a virtual machine or JIT compiler
 
@CatPlusPlus uhm, "machine code". the term "bytecode" is generally reserved for virtual machines.
 
wow. Apple blocked their whole dev page behind a paywall
 
12:46 PM
It's bytecode either way.
 
bastards.
 
@RadekSlupik: thanks
 
Virtual machine code.
 
Ell
machine code is native
 
JIT generates machine code.
 
12:47 PM
JIT =/= compiled.
 
And there's always runtime support, anyway.
 
Ell
yeah but you can't compile to native can you?
which was my question
 
@Ell: once again, define "compile to native"
 
@CatPlusPlus well, as much else it stems from the Smalltalk project. then there was UCSD Pascal which popularized the concept and the term. it's pretty much established by now, 30 years later.
 
JIT compiles your code on-the-fly to native machine code
 
Ell
12:48 PM
compiling to machine code
 
Geez.
 
PyPy does that.
 
@Ell My CPU executes Python directly! NATIVEZZ!!
 
The problem with Python is the dynamic typing
 
Native == compile once, run many times without recompilation, executing native CPU instructions.
 
12:49 PM
Even when you have an executable image like .exe, it's not just "relying on CPU & OS", so your definition is quite useless.
 
So PyPy waits until it sees a pattern of types being used in a place
 
You guys are being irritating.
 
and then compiles a native version for that type
 
@nightcracker Objective-C does dynamic typing and it compiles to machine code too. Not a problem. In C++ you can achieve it with void* everywhere and a lot of casts.
 
@RadekSlupik at one time language-specific CPUs were all the rage. there was a number of them for Lisp. and I think at least one Java CPU.
 
Ell
12:49 PM
do you guys really not know what I'm trying to ask or are you being pendantic?
 
@rubenvb It's a silly notion, that.
 
@Ell what is your question?
 
@CatPlusPlus A silly notion used in about 90% of the programs running on your computer.
 
I'm saying the "nativeness" is overrated and quite useless.
 
@RadekSlupik: are you sure it does dynamic typing and not type inference?
 
12:50 PM
@nightcracker Objective-C doesn't support type inference. You need Objective-C++ for that.
 
Ell
my question is can python be compiled directly to machine code?
 
@RadekSlupik But it has runtime support library, so it's not native!!!11111
 
@Ell: short answer: no.
 
It's like VM!111
 
Lol, even C has runtime support
 
12:50 PM
C++ has a runtime support library too. >.>
 
Ell
right kk thank you
 
That's why I'm saying this fucking "native" definition is pointless.
 
@Ell: long answer: yes :D
 
VM is just a runtime support for generated code.
 
take for example Cython
it translates Python into C with the Python runtime
is that "native" ?
 
12:51 PM
BUT IT HAS RUNTIME SO IT'S NOT NATIVE
 
@Ell Most C++ implementations compile to native machine code. There are a few C++ cross compilers and one known C++ interpreter. Plus there are Microsoft's C++ extensions that can compile to .NET bytecode.
 
Java is by definition not native
 
@CatPlusPlus runtime != not native.
 
(unless the JVM is the native CPU language)
 
But then you have .exe with .NET assemblies which can be executed by double clicking and rely only on one DLL.
 
12:52 PM
yet no one complains there
 
@nightcracker You can compile Java to machine code just as well.
 
HOW DOES IT WORK
 
MAGIC
 
@rubenvb WHY.
 
C and C++ runtime is just a bunch of gathered machine code instructions, that don't change or get recompiled when you execute them.
 
Ell
12:52 PM
or you can have hardware accelerated JVM
 
Gods.
 
Java is completely different.
 
indeed.
 
And you can compile fully dynamic Python code to C++ code which calls Python APIs.
 
@rubenvb Well, the Python runtime for CPython is written in C too.
 
12:53 PM
And not ever recompile it.
And it won't change.
 
Well, I would classify that as "native" then.
 
@CatPlusPlus: that's what cython does.
 
That's what fucking JIT does.
 
Ell
can you do stuff like eval there?
 
If your Python itself isn't JITed.
 
12:53 PM
YES.
You could eval C++ too, if you'd plug GCC in runtime support.
 
Ell
calm down o.O
 
@Ell s/a/i
 
Because JIT is well, compiling at runtime, which is not native.
 
it has an extra transformation from language code to machine code.
 
12:54 PM
It generates directly executable code.
 
That's the thing, it needs to generate that code.
 
There's no VM layer executing the bytecode.
 
A compiled C++ program doesn't generate code.
 
So what? It just has compiler bundled with the program.
 
@rubenvb It can do that.
 
12:54 PM
@RadekSlupik it can, yes, obviously, that's not my point.
 
Ell
I get the point runtime vs native vs static vs jit vs java vs c++ vs other st00f distinction is unnecessary
 
If I bundle GCC with C++ program and call it the first time you run ./exec.sh, it's no longer native?
 
@CatPlusPlus hence not native.
 
Riddle me this.
 
@CatPlusPlus If it runs only once, of course not. That would be an optimized installer ;-)
 
12:55 PM
void eval(std::string const& code) {
    auto func = compile(code);
    func();
}
 
It's not that hard: native code == no additional translation.
 
Take for example Cython
 
What if it discards the image and runs every time?
 
You feed it a Python file
and it poops a .c file
which you can compile and link to, say, -lpython27
 
@CatPlusPlus that would be very bad JIT.
 
12:56 PM
Guys I found a way to make C++ not native!111
 
from that point everything is in C, with calls to the Python API
 
10
A: What is Native Code?

John MillikinNative code is machine code executed directly by the CPU. This is in contrast to .NET bytecode, which is interpreted by the .NET virtual machine. A nice MSDN hit: Debugging Native Code

Problem solved.
 
Your notion of nativeness bewilders and amuses me.
 
the problem is
 
(Not that it matters at all.)
 
12:57 PM
when talking about "native code"
 
Anyway, who the fuck cares?
 
it's the notion of real hardware. no matter how many layers of interpretation there is in the hardware and firmware, it has to present some set of instructions. that's the native code.
 
If my Python JIT-compiler or even interpreter is fast enough to do the job, I don't need no machine code.
 
I'd like VMs everywhere. They make life easier.
 
is the output of the compiler "native code" or the input?
the output of course
 
Ell
12:58 PM
@CatPlusPlus why would vm's make things easier?
 
PyPy outputs "native code" on-the-fly
 
@Ell Everything is managed. Much easier to debug.
 
pure. machine. code.
 
@RadekSlupik until there's a bug in the VM.
 
@Ell Segfault? You immediately know where it comes from. Stack traces? Easy as shit.
 
Ell
12:58 PM
@RadekSlupik isn't that a property of the language? Would a c++ vm help?
 
@rubenvb CPUs can't have bugs?
 
They can, and have
 
@RadekSlupik sure, but either Intel/AMD release those fancy microcode updates or you're screwed. The thing is that a VM adds an additional layer of possible bugs.
 

« first day (645 days earlier)      last day (4304 days later) »