Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
feedmegin
Jul 30, 2008

Monkeyseesaw posted:

We need a language where the only data type is a string and when you do non-string operations like arithmetic it converts it to some internal representation, does the bit shuffling, and returns the result as a string. All functions are simply extending the string type.

But you still have to explicitly declare your variables as strings JUST TO MAKE SURE.

SNOBOL was pretty much literally this. It's right there in the name, 'String Oriented Symbolic Language'.

Adbot
ADBOT LOVES YOU

feedmegin
Jul 30, 2008

Ryouga Inverse posted:

This sounds great until you realize that it means you have to install Qt 3 and 4 side by side on any machine that you want to run Qt apps for an arbitrary amount of time, because there's always that one rear end in a top hat who wrote his poo poo for Qt 3 and then had the audacity to die or something.

I mean, there are arguments to be made for both, but you certainly can't change your API every time you have a whim, and in some cases (like the Internet) you can't ever break backward compatibility. And the problem is that those cases look exactly like the best-case success story that you only dream of.

Qt is also good at not changing its API on a whim. Within a major version number, it remains forward compatible at a binary level (code compiled for Qt 4.2 will run with Qt 4.7). They only break things every few years with a new major version number. For open-source C++ libraries, that's pretty rare.

I personally can't think of any Qt 3 apps still sitting around that I run, but I can imagine the scenario cropping up. That's life, basically, there's not a good alternative to having both sets of libraries sitting around.

feedmegin
Jul 30, 2008

Null Pointer posted:

IA-64 makes the compiler (or assembly programmer) responsible for almost everything, including instruction scheduling and data hazard resolution. The first Itanium chip was delayed for some years, in large part due to the fact that compilers turned out to be harder to write than the HP engineers thought. As far as I know the compilers still aren't very good.

Not really. In theory the idea was that the Itanium chips could be very simple (and thus very highly clocked) because of this philosophy, but the instruction set architecture doesn't really reflect that. It's actually pretty complex, partly because it was a design by committee between Intel and HP (the latter wanting to provide good backwards compatibility with PA-RISC, their previous instruction set architecture). Bad compilers could have been forgiven a lot if the chips were like twice as fast as their competitors, but they weren't.

feedmegin
Jul 30, 2008

dancavallaro posted:

I'm going to have to go with troll. Even if you are operating under the misconception that objects are passed by reference, it still wouldn't be "arbitrary".

No, I can see what he's saying, he's just explaining it badly. Basic types are passed by value. So are references to objects, but that means the object itself acts like it's pass by reference (the object isn't copied, the reference to it is). This is non-obvious in Java since pointers aren't explicit.

It isn't arbitrary, of course, it's logical, but I think that's what he's getting at.

feedmegin
Jul 30, 2008

haveblue posted:

Yes, you can use the const keyword to make the compiler enforce that.

But the function can use const_cast to make it modifiable again. It's basically silly to try and 'force' a C++ library not to do $thingyoudontlike like this. Trust the library not to do something you dislike, or write a new library.

feedmegin
Jul 30, 2008

hobbesmaster posted:

Sometimes its hard to tell if people are joking, but I've only ever seen XOR in my logic textbooks... it really doesn't matter but I have this twitch whenever I use ARM assembly.

ARM is a British-designed ISA. We don't cotton to xtreme letterz as much as you lot :britain:

feedmegin
Jul 30, 2008

Jabor posted:

1's complement and sign-magnitude are the other two options.

Also it doesn't guarantee that all possible bit patterns are actually valid.

There were actual real computers using non-twos-complement maths around when C became a Thing -

http://en.wikipedia.org/wiki/CDC_6000_series
http://en.wikipedia.org/wiki/IBM_7090

for example. There might even be some still knocking around with modern C compilers, for all I know; it makes sense the C people wouldn't want to rule out the possibility.

feedmegin
Jul 30, 2008

Optimus Prime Ribs posted:

Everyone has their preferred way to write code.
But why should I be penalised for not conforming to the professor's preference?

In the real world, whether open source or commercial, you'll generally be expected to conform to the existing style of any large body of code to which you contribute. Doing otherwise is aggressively antisocial. I suggest you get used to it.

feedmegin
Jul 30, 2008

That Turkey Story posted:

I think I still probably have some of the first code I've ever written on an old hard drive. I need to dig it up and post it at some point. I remember looking at it a couple of months after I'd written it and realizing how horrible and buggy and leaky it was. I can only imagine what I'd think of it now (over a decade later).

Hard drive? My first code was on a zx spectrum's tape drive somewhere. Kids these days :corsair:

feedmegin
Jul 30, 2008

Freakus posted:

Note that mysql's utf8 doesn't support 4 byte characters. If you want that you need to use utf8mb4.

Hmm. How good are MySQL/other languages/environments with combining characters in Unicode? Turns out that some characters (for instance ancient Greek alpha with spiritus asper and acute accent) can't be represented in one Unicode codepoint at all ever. Seems like that'd trip some developers up :sun:

feedmegin
Jul 30, 2008

TheFreshmanWIT posted:

So here is an interesting defect that sorta plays into the UB discussion above. We write C++ code that runs on a few platforms, Win Desktop, WinRT, Android, and iOS. The result is we have a set of 'base' C++ code that compiles on every OS. One such component is an open source library that we've purchased a commerical (non GPL'ed) version of.

Qt developer spotted? ;)

feedmegin
Jul 30, 2008

Dren posted:

I thought they were on the stack.

Generally speaking they're in a read-only section of the executable file (e.g. .rodata in ELF on Linux, .rdata in PE/COFF on Windows) that is mapped into the process's address space just like the executable code is. So definitely not on the stack, not technically on the heap either, guaranteed to stick around until the process/DLL is unloaded.

feedmegin
Jul 30, 2008

Gazpacho posted:

C++ code:
string fileContents;
readFileIntoString(filePath, fileContents);

unsigned long outBytes = 0;
const size_t bufSize = 16384;
unsigned char * in = (unsigned char *) malloc(fileContents.length());
unsigned char * out = (unsigned char *) malloc(bufSize);

memcpy(in, fileContents.c_str(), fileContents.length());
memset(out, NULL, bufSize);
someTransformation(in, fileContents.length(), out, bufSize, outBytes);
free(in);
in = NULL;
string s = string((char *) out);
free(out);
out = NULL;
The project is C++ but there was a dev on the team who always thought it should have been C instead. One way he expressed that was by writing code like this.

For that to compile presumably there's a using namespace std; in there somewhere. Which is also horrible :colbert:

feedmegin
Jul 30, 2008

leper khan posted:

if (!(foo > 0)) {
..
}

Not sure I understand this one? (-1 is true in Calikes, remember, so this is 'do this if the value is 0 or negative', which seems fair enough)

feedmegin
Jul 30, 2008

Zombywuf posted:

Give it up, ADA is never going to be a thing outside the defence industry. Even there it's loosing ground: https://en.wikipedia.org/wiki/Lockheed_Martin_F-35_Lightning_II

Ada is not an acronym...

feedmegin
Jul 30, 2008

Munkeymon posted:

Ada isn't the language that either compiles and runs or, if you have any error, says 'No' without any explanation, right? I'd really like to clear that up if I have it wrong.

That's not a language thing, that's a 'my compiler is poo poo at reporting errors' thing. The language in no way mandates bad error reporting.

feedmegin
Jul 30, 2008

QuarkJets posted:

That's because the terminal that comes with OS X is garbage, whereas most Linux terminals are pretty good by default

Aren't they all terminal emulators technically? A real terminal is, like, a VT220.

feedmegin
Jul 30, 2008

Zopotantor posted:

[1] Currently on 4.1 since we're still using RHEL 5. Our customers are very, very conservative and need serious arm-twisting to agree to OS updates.

Feel lucky. We still have customers running RHEL 4. On a Pentium III.

feedmegin
Jul 30, 2008

nielsm posted:

Sorry, no. It's Japanese for "my way or the highway".

Or in other terms, "really inflexible".

Hence, you know, 'rails'. As in railroading. As in on a railway where you don't get to decide the direction you go in. It is sort of right there in the name.

feedmegin
Jul 30, 2008

Dessert Rose posted:

Fundamental to C-family languages. Well, except C.

And, indeed, Java (to start with and the way they've shoehorned it in is pretty much an afterthought), Objective C, and even early C++.

feedmegin
Jul 30, 2008

omeg posted:

I've been looking over the leaked win2k (?) sources some time ago and the biggest horror is the GUI subsystem. It was literally COMPATIBILITY HACK one after another. And it didn't change much. win32k.sys (the kernel part of window/GUI manager) is still one of the most exploited Windows components.

The fact that the window manager (and standard UI components, listboxes etc? I don't remember) is running in Ring 0 is a horror in itself. It's like if Unity and Gtk/Qt were kernel modules.

feedmegin
Jul 30, 2008

JawnV6 posted:

Can still invoke branching on some hardware. MSP430 sets it up as a case with fallthrough for anything between 1-7. For a variable it does an indirect jump.

Edit: re-read the comment. I am a dumb. ICSC2_BDIV looks like a macro constant but presumably it's not (in which case it would have been a lot clearer if was something more like READ_ICSC2_BDIV() :/)

feedmegin fucked around with this message at 18:47 on Oct 3, 2014

feedmegin
Jul 30, 2008

Plorkyeran posted:

Rust is the only one of those three that is a system language without GC.

While ARC is a form of GC it is deterministic and predictable.

feedmegin
Jul 30, 2008

b0lt posted:

bzip2 is a decade old project that supports all sorts of awful platforms

Even mainstream compilers have lacked 64-bit arithmetic in the not-super-distant past, which is why things like this exist -

http://msdn.microsoft.com/en-gb/library/windows/desktop/aa383742(v=vs.85).aspx

feedmegin
Jul 30, 2008

ctz posted:

That struct was introduced in Windows 95 Service Release 2 (1996). I think that's distant past with respect to computing.

Dude, the company I work for still supports our software on MicroVAXes. Don't underestimate how far legacy support can go. ;)

feedmegin
Jul 30, 2008

fritz posted:

If the compiler puts debugging symbols in the binary, longer variable names will mean that it takes longer for the os to load the executable from disk and it adds to memory pressure


Debug symbols go in separate sections of the executable (eg .debug_info) which are not loaded into RAM by the dynamic linker :science:

feedmegin
Jul 30, 2008

GrumpyDoctor posted:

I guess I'm nervous about trusting not-required-by-standard C++ behavior that just happens to be implemented by all major compilers (which I didn't actually know, so that's cool).

I imagine tail call elimination is only implemented with compiler optimisation turned on, and I'd be nervous about it always working in any case where it not working would suddenly blow up my stack. You are not guaranteed any particular optimisation that's not in the language standard after all.

feedmegin
Jul 30, 2008

GrumpyDoctor posted:

Right. But some languages do guarantee tail-call elimination; it's not an "optimization," it's the semantics of the language.

Yes, which is why I phrased it the way I did. If you're doing Scheme, it's guaranteed by the language standard so you can rely on it. C++, not, so no.

feedmegin
Jul 30, 2008

Blotto Skorzany posted:

2-byte floats?!

16 bit floats are actually a common thing with GPUs, however.

feedmegin
Jul 30, 2008


Uh, won't zeroing the stack until a page fault on a modern operating system basically just make the kernel allocate a poo poo-ton of RAM to the process until the stack hits the heap or the system runs out of RAM, whichever comes first? Generally there isn't a syscall or anything to extend the stack, it's something the kernel handles automagically.

(And assuming a single-threaded process and 64 bits, the stack and the heap are likely to be a long way apart...)

feedmegin
Jul 30, 2008

qntm posted:

VERY CAREFULLY

I assume everyone here has seen http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags by this point...

feedmegin
Jul 30, 2008

TheresaJayne posted:

NotOnMyOS (NOMOS)- this language will not run under any operating system as it classes them all as waste of space, uses hardware directly

Otherwise known as embedded C? :)

feedmegin
Jul 30, 2008

Suspicious Dish posted:

Fortran? The language where everything is global and you can redefine a number literal with a SWAP procedure?

Fortran, which doesn't traditionally have a pointer type, meaning you can assume that variable a isn't going to be modified by someone doing b = &a; *b = 42. For optimisation within a function this is way more important.

feedmegin
Jul 30, 2008

LeftistMuslimObama posted:

I guess what confuses me, though, is why there isn't a command that's just "Make a new process with this program/function and these arguments and then link it to me as a child". It seems like it would do the same thing as fork()+exec() with fewer lines of code, unless the lecturer for my class simply didn't explain the nuances well at all.

There is, on some Unixen. Google posix_spawn.

feedmegin
Jul 30, 2008

kitten smoothie posted:

Older devices? Zawinski was blogging just a few months ago about lovely cheap Android "smart tv" boxes that all had the same MAC address burned into them. Seemed like a cheap way to run advertising on a TV screen except you can have only one :D

http://www.jwz.org/blog/2014/10/flyer-screens-2/

Otherwise you need some kind of per unit step on the manufacturing floor to change the MAC and that costs money and you (the Chinese factory) can get away without it :shobon:

feedmegin
Jul 30, 2008

Volmarias posted:

I can assure you that "refactoring" wouldn't have solved the issue, because despite looking simple on the surface, Kindle Reader is actually really complicated and has to deal with a bunch of older formats basically forever.

He's not kidding, this is a code horror in itself. I wrote a Mobipocket (which is the format Kindle started out with) ereader for Android for fun, using Qt. Under the hood, Mobipocket is just one giant HTML 3.2 file (yes, that old) containing the text of the book, with GIFs the only allowable image type and that with a strict size restriction, stored in a series of LZ-encoded 4k buckets within an arcane archive format that originated on the Palm Pilot. There's some serious software archaeology in there. Kindle has a new totally different format that by all accounts is much better, but there are still zillions and zillions of books out there in the old format of course.

feedmegin
Jul 30, 2008

Suspicious Dish posted:

Wait, that means that if I attach a debugger to an existing process, the thread names won't be there? What the gently caress?

I would assume you get a numeric thread ID.

feedmegin
Jul 30, 2008

Suspicious Dish posted:

For however bad X11 is, lmao at anybody thinking NeWS is any better. NeWS involved people writing custom PostScript scripts to shove inside a giant rear end display server, get access to the entire global namespace, even do filesystem and network operations. Not to mention that they added a way to load NeWS at runtime from an untrusted source. So you could just randomly pwn some machines on your network by sending them malicious PostScript scripts that were self-replicating and inserted them into your system at boot.

That was a different time though, back in the mid-80s when telnet and rsh were considered just fine for example despite sending passwords in cleartext over the wire, everyone ran fingerd, etc, etc. Back in the days before ubiquitous internet access to everything people didn't generally worry so much about security.

feedmegin
Jul 30, 2008

omeg posted:

For those not familiar with winapi, it's basically initiating an asynchronous write (to a pipe) and then... just waiting for the completion. It can be replaced with a single synchronous WriteFile() call.

Of course, the Linux/Unix-y way to do this is simply to call write() synchronously too, it's async i/o which would be weird and different :shobon:

Adbot
ADBOT LOVES YOU

feedmegin
Jul 30, 2008

JawnV6 posted:

I'd be curious to see what a peek at the disassembly revealed. Guessing the 90's gcc is using the x87 FP stack that a modern processor will dutifully execute much slower than an equivalent SSE-enabled flow.

Probably better register allocation too - graph colouring was still under patent back then. And if he also went from 32 to 64 bit x86 then there's twice as many integer registers to play with as well, plus as mentioned SSE for floating point.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply