> === compares values and type… except with objects, where === is only true if both operands are actually the same object! For objects, == compares both value (of every attribute) and type, which is what === does for every other type. What.
who tf designed this beast of a language. This is even worse designed than what garbage I make. I take it back. I prefer randomly tagging people in chicken nugget photos to PHP
There are some terrible things about PHP, but it... works. And there are a handful of good ideas that went into it, even though the execution of them was questionable. And like many poorly designed but popular languages, it slowly becomes not bad over time (even when a redesign might be better)
@Aaron3468 In fairness, PHP is getting better over time. Using a finely tuned extrapolation algorithm, we find that (assuming the current rate of improvement continues) by approximately 2137 CE it will approximately equal the quality of Fortran 66.
@Darkrifts It will, around 2073 CE. A patch will be written around 2103 CE. This will prompt a rant from Linus Torvalds III that "grandpa taught me how NULL should work, so fuck all you with these attempts at type-safety. Just fuck you!"
But seriously, if I ever write a language, it's going to expect you to either throw a proper NotInitialized/DoesNotExist/NotYetAvailable Exception, or that you initialize with a predictable default/empty value and mutate it once the information is available. Chasing Nulls is not a fun task
On the other hand, if I ever write a language, may god have mercy on my soul and save those who use it
@Aaron3468 This is one of those times I'm not sure whether I'm really joking or not. I find it a bit humorous, and when I say it I'm not particularly serious. At the same time, I'm not entirely convinced that it's incorrect either. Part of it is that looking back on things, language translation was where I see myself as having transitioned from "messing around" to doing more systematic programming.
It all started from a 3D graphics program in Applesoft. It required you to edit the function you were going to graph into the program itself. I didn't approve of that idea, so I started figuring out how to enter that function separately. It took a long time before I had (what I thought of as) a satisfactory solution to that.
@StackedCrooked I'm thinking at a little larger level than that. In early classes and such we'd implemented sorting and trees and such, but never put together much of a system from them. A sorting program would ask you to enter some numbers, and it'd print them back out in order--but it wasn't really useful for much (especially on systems that didn't support I/O redirection, piping, etc.)
The first translator was the first time I had to put together an actual system with a fair number of "moving parts" that actually worked together to accomplish a bigger task.
@JerryCoffin I think you've hit on a fine point. As a programmer, I grow most when I take on difficult problems and solve them my own way. Pathfinding algorithms and 2D rendering have been my own major areas of study, along with emulation. Reinventing the wheel is by far one of the best ways to learn; programming is a problem-solving discipline and mastering more problems is an excellent strategy.
@StackedCrooked I think there's a little more to it than just "this was the first larger project I personally undertook" though. Language recognition is also a place you come face to face with some things that initially seem entirely different (e.g., regular expressions and finite state machines) actually being precisely equivalent (and the same applying to a lot of problems about things like computability in general, not just one pair of things that happen to work out the same).
I would use parse1.
Technically, parsing only requires recognizing that an input matches some particular grammar--that is, the qualification part you've mentioned.
That's almost always accompanied by transforming input that allows an (often large) number of variations, and transforming it into ...
The only other thing I might add is that the next step can optionally be called translation (compiling/assembling/linking), if the steps are to be disambiguated. The answer you've given is pretty much my understanding of the issue.
@LucDanton I'll try to provide some much needed relief then. In C++, if I understand well (yes this is probably where the premise fails), aliasing rules say you can reinterpret _cast anything to char* but not the other way around. Given that, is it truly impossible to have a pedantically-correct implementation of a 0-copy mechanism that reinterprets a char* buffer in memory, provided by an external source (mmap, socket...)? Assuming correct alignment etc.
trivially copyable types are exactly about those types
writes bytes, get value
(in this case the write is whichever way you had those bytes)
admittedly there’s a leap of faith where you have to say out loud 'yes this place in memory was totally intended as an object of type whatever from the start'
but as long as you throw some salt over your shoulder while crossing yourself you should be fine
In windows we can associate a file's extension with programs.
E.g. a file test.pl can be run by the installed Perl interpreter due to the pl extension.
In linux though it needs #!/usr/bin/perl as the first line.
Is this because there is no association between file extensions and programs in Linux?
"In general Unix doesn't rely on the suffix of files. Many programs neither needs nor automatically adds their typical suffixes" "Instead the file is identified by it's content through a series of tests, looking for "magic-numbers" and other identifiers "
@MooingDuck all this holds for linux, yes, but windows is not that way at all, so if you are coding for another platform, is necessary to use extensions
also, compilers do care about file extensions, even on linux
when linking a library from the command line you have too options
again, I doubt that’s true or useful—all the programs I’ve ever used let me point to the files of my choice, then it works or not. whether that involves magic numbers or not is a red herring, too
GNU libiberty is a software library with a collection of subroutines used by various GNU programs.
It was originally intended to be a sort of standard cross-platform library, thus enabling it to be linked (using the usual Unix library form) by just saying "-liberty". The contents consisted of a variety of useful functions. However, the development of standards for C and POSIX took away some of the impetus for this, and libiberty came to be used primarily as a support library for the GNU toolchain.
Copies of libiberty are distributed with gcc, gdb, and the binutils.
One important piece of libiberty...
when i compile and run code on my laptop it works perfectly (ubuntu) but when i do that on my university desktop it enters an infinite loop while reading file (ubuntu). any possible causes?
difference is they have ubuntu 12.04 with g++4.6.3 and i use ubuntu 16.04 with g++5.1.0
I'm not sure I entirely like the unix philosophy of having no suffix. At very least a standard file header should be expected to indicate the ballpark of how to interpret the file (aka, a file suffix)
@Xeo Just looked it up. I remember it now. Honestly, it has good concepts, but Early Access is terrible just about every time. The design is pretty fantastic, but I'd prefer to wait until I know what direction the dev team is headed.
Given a struct like this:
struct Foo
{
int x;
int y;
double z;
};
BOOST_FUSION_ADAPT_STRUCT(Foo, x, y, z);
I want to generate a string like this:
"{ int x; int y; double z; }"
I have seen how to print the values of a Fusion adapted struct, but here I need to print the ty...
@BartekBanachewicz The bottom is fine even if slightly underexposed (though I don't think it actually is underexposed, maybe except for one or two areas); it's been taken at like 6:30pm in late September, at 200mm of a 18-200mm lens, at f/5.6. So... I think it's pretty good.
For the past few days, I've been working through a problem building Ogre3D. The platform I am compiling on supports Opengl Embedded Systems 2 natively, but these headers do not appear to be a part of the dependencies package for Ogre.
Solved Problems
Cmake's CodeLite Generator has a Kn...