Jump to content

Sebivor

Member
  • Posts

    67
  • Joined

  • Last visited

Awards

This user doesn't have any awards

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Sebivor's Achievements

  1. Regular expressions... if assembly is considered as expressive as any other language, then it must have regular expressions for matching against strings. Haskell has pattern matching on other types, too. There's a lot of ignorance going on here, I feel like we all just need to open our freaking eyes a bit more... and not swallow the crap other potentially ignorant people feed us without question... you know, cross-reference our resources... like we should in university.
  2. How do you declare a higher-order function in assembly? Take `qsort` and `bsearch` for example, here are their prototypes: void *bsearch(const void *key, const void *base, size_t nel, size_t width, int (*compar)(const void *, const void *)); void qsort(void *base, size_t nel, size_t width, int (*compar)(const void *, const void *)); ... and `puts((splice_queue[splice_queue_size_hi] & 1 << lo) ? "\?\?/" : "\\");`... How is that written in assembly? Is that all going to be one expression? Because it seems this expression is too complex to be considered low-level in any capacity... How do you write compound literals and designated initialisers in x86 assembly? What is the nearest analogy for the `sizeof` operator in assembly? Do you still think C is low-level? How do you switch from real mode to protected mode, in C? I think the problem here is we are talking with a narcissist who likes to think he knows C, he might even have a professor who likes to make him think he knows C... maybe... I wouldn't believe everything he says, though, as he doesn't seem to know what we're talking about. Stewie isn't who I'm talking about, but the ignorant rubbish might be rubbing off on him a bit... I assume one who would read a book on applied linguistics would also read C11/5.1.2.3p1... and p4... Can show me an example of agglutination in assembly? The preprocessor makes it pretty simple in C... check this working example out: #define expr_as_str(expr) #expr #define join(x,y) x##y #include <stdio.h> int main(void) { join(pu,ts)(expr_as_str(You might think this is complete rubbish but it works)); } Do you know of any way to do anything like this in x86 assembly? ... I am also looking at you wasab, as you said, the onus is on the person who makes the claim... what is the assembly language idiom for this? Note that you appear to be using turing completion as an argument. I'm not saying these languages aren't turing complete... it's just, you know, x86 assembly doesn't have some features that C does have... and those features make C high-level. You're welcome to try to translate `join(pu,ts)(...)` if you like... it should be pretty straight-forward, but you also won't be able to use those features at all in assembly... right? Allow me to be absolute with you... where is your book? That's the only reason I come here now, after all... `goto` as it stood in 1968 (which was a long time ago) was a very different beast to what it is today. Actually, Djikstra wrote it as `GOTO`, if I recall correctly, so... that was about BASIC, not even C! The behaviour was very different back then, too... much more like JUMP in assembly, you know? `20 GOTO 10` and so forth... Able to transfer control outside of the function is not good; keeping control in the function is not so bad. C came around long after Djikstra retracted these claims that seem to curse us constantly now... heck, C came about after "Goto considered harmful" considered harmful was published (1978)... thus this belief that "goto is evil" has been defunct for a long time now. In short, your concerns appear to be antiquated and sheepish... but then again, you can expect that from someone who appears to have narcissistic personality disorder... does it hurt too much when you're wrong? Awww, tiddles! I wonder how the rest of us cope... I don't get along well with people that have cluster B personality disorders... you want all the attention in the world to the point where you'll change the goalposts and manipulate to no end to get it, even when it makes you look like that. Good for you! def fubar(a, b): return a + b; print fubar('hello', 'world'); print fubar(42, 1); Sorry, I couldn't help it... they're not going to be able to translate THAT into assembly easily, right? C kind of has this, too, in the form of sockets and pipes treated the same as files, and `bsearch` and `qsort`, of course... assembly doesn't natively have this concept, as far as I can see. Actually, I wouldn't consider Linus Torvalds uses of `goto` to be particularly clean, at least not the first few. Maybe you intentionally chose some poor examples to try to make him look foolish, if so that seems to have worked pretty well. You've given some much better examples below that, though you've also had me warned for telling people like yourself when you need to read more and guess less. You're not drivelling all of the sudden. It's good to see eyes open... I wonder what changed... was it my ways? Cascading error handlers are good, as is jumping out of multiple loops without an intermediate variable or jumping into another switch label to avoid duplicate code... that kind of thing. In PMs I provided some more in the form of my solution to exercise 1-23 (from K&R2E, you know?)... I'll be most interested in seeing how they manage lines 167 and 176... it's a shame we all can't just read the books and do the exercises. I guess we don't all need to, since some of us can just drink beer and vomit instead.
  3. The paradigm you speak of is imperative. Spaghetti code is a synonym for messy code, in those languages. Of course, spaghetti code can exist in languages that don't even contain `goto`... consider Java, with it's `try/catch` and `throw`... at least `goto` doesn't let you jump outside of a function unpredictably, right? Indeed, we can write rubbish in any language we like. Perhaps we should just stop speaking, reading, writing and listening, and snort HEAPS of cocaine. I think that could work. I've played with some nice assembly languages. It's not really my style; I prefer the more expressive languages, but meh.
  4. With definitions from our textbooks in mind: Level of abstraction from hardware does not necessarily impact the turing completion of the language. If you'd like to know more about turing completion, read a book... I don't know, TAOCP could be okay. Or have me warned for telling you to read a book; apparently that solves problems. C is not really "low level", and most assembly nowadays isn't really "low level" for that matter; C can't be low-level because it facilitates the construction of complex expressions that are composed of ... perhaps other complex expressions... and similarly complex types. If we go by SICP, then C fits quite snugly into the category of "high level". There's also the fact that the standard defines C in the context of "the abstract machine", which is an odd thing for an apparently low-level language to be described as. In the low-level land of x86 assembly development, you would need to switch between real and protected mode, and communicate with the BIOS using different interrupts depending on the devices you wish to read/write from... because you get no standard library, you would need to find some drivers and write your own allocator to allocate memory for you. You know... Java is pretty low-level, if you run it on a SIM card (A.K.A. a "Java card")... but the down-side there is you don't get strings or garbage collection, right? Having said that, I would tend to ignore any use of the terms, as they seem to have become... watered down... over time. It's a shame about that, but let's face it, there are better (as in more descriptive, more meaningful) terms to use, such as: Procedural/imperative, functional or logic-based (depending on the "high-level" paradigm chosen) Ad-hoc polymorphic, parametric polymorphism, subtype polymorphism... or equivalents (they do have synonyms) Lazy or strict (evaluation method) Static (explicit conversions only) or dynamic (some implicit conversions) Weakly typed (variables can be re-bound to change type) versus strongly typed (variables can't be re-bound)... Object oriented, too, of course, though that's kind of an extension of the others (as demonstrated by Clojure and Logtalk for example)... those who read books tend to describe it more as a restriction than an abstraction, and the languages don't tend to rigorously enforce or punish you for disobeying core OO principles, so... pinch o' salt! ... and so on... Plenty of paradigms to research there, yep... lotsa books to read...
  5. I only come here to clear up facts as stated by textbooks and suggest that people read said textbooks, now. If you ban me I will register a new account under the same email address, but it won't look the same... and you'll see it and realise at this time, you can't ban the people who know how to exploit the internet.

    1. CodeNova

      CodeNova

      Rock on, another keyboard cowboy.

    2. dizmo

      dizmo

      I don't think anyone really cares enough about you to care about that, tbh.

  6. Sebivor

    C++ and C

    I'm trying to figure out what that means... are you trying to say you would hire someone who admits to knowing C89 but not C99? Would you also hire someone who admits to knowing C++98 but not C++05 or C++11? Because as time progresses, languages change... right?
  7. Sebivor

    C++ and C

    Founding forefather of C++, Bjarne Stroustrup, has written a book for introductory programming students (i.e. those with no prior experience) and a book for intermediate students who already have some prior experience or maybe know another procedural language. I've not read them personally, as I've had my sights on other languages (such as Kotlin, Javascript and so forth)... but these are probably the ones I would pick if I were to focus on C++.
  8. Sebivor

    C++ and C

    I acknowledged a warning from two years ago to write this post up... You have been "warned"... whatever that means to the kind of person who finds flaws that can break the internet, ha! I'm not salty, though, guys... if you want to look like idiots, feel free. Even in C89, these are features that C++ doesn't have: implicit `void *` conversions... not only do people tell you not to cast `malloc` in C++, they tell you to flat-out avoid `malloc` in C++. I wonder why? namespace-related discrepancies... unless you can get this code compiling as C++. "C allows hexadecimal floating point literals (eg. 1.1p-3), which are not valid preprocessing-tokens in C++... There are minor differences in the handling of universal character names (eg. \u0234)" C89 permits a recursive `main` function; C++ does not. I would honestly continue; I'm sure I could, but would you read these words if you wouldn't read a book? Or how about reading this F.A.Q. written by Bjarne Stroustrup, founding forefather of C++, instead? Cue the next "warning"... This discussion becomes completely unfair if you restrict C to C89, unless you also restrict C++ to C++98, as the world has moved on since these two language dialects and you won't find an employer taking you seriously if you don't also know C99, C11 and pretty soon C18 too. After all, would you hire someone who's so out of touch? Then if we accept all of those more recent standards (as we should, since the rest of the world considers them standards) as defining C, then you should have `_Generic` (among a whole heap of other silly features that C++ already accommodates for) in C++ by now... good luck trying to convince the C++ standards committee to endorse that! Oh, let's add one more thing to the list of reasons to give me a warning, huh? Where is your tokenizer?
  9. That's unfortunate, because if this were a gambling game or a security application that's the one thing I'd change. `rand` doesn't guarantee random in an unpredictable sense; to the contrary, it is extremely predictable. Just a quick mention, so that you don't go assuming you can use `rand` to generate random passwords for your own accounts... you can, but they won't be secure... at all! My suggestion would be to store all of your words into an array, as others have suggested, and then shuffle the array to get the desired random order. #define nelem(array) (sizeof array / sizeof *array) for (size_t x = 0, y; x < nelem(word); x++) { do { // this inner loop discards bias that occurs when our range doesn't divide evenly into rand's range y = rand(); } while (y >= RAND_MAX - RAND_MAX % nelem(word)); y %= nelem(word); char *word_x_ = word[x]; // and here is our shuffling; "swap" the current element with a randomly chosen element word[x] = word[y]; word[y] = word_x_; } Once you've shuffled, you won't have to worry about removing elements from the array or modifying it in any way. Just loop over your array, prompting the user for their guess)... If they get it wrong, don't increment your loop counter... Only increment the loop counter when they guess the word correctly.
  10. ... and I'm sure you'd miss your favourite laptop if you were to part ways with it. I understand this much, and that's where this answer's coming from. There are several solutions to this problem, including those which have been mentioned: dualbooting and emulating Windows. In order of my preference (of keeping my favourite environment open while I work, preferably working inside of it), I would: Investigate non-Windows alternatives; for example, if you're learning about C# you might be able to do most of your work in Mono or (better yet) llvm/clangsharp. Alternatively, you could run Windows inside of an emulator, which trades off a bit of performance for the ability to switch back and forth between OS X and Windows quickly without rebooting the computer... If you're writing a game in Windows, you might need better performance to test it... and dualbooting might be your only option, in this case. You could do that... but you have three other alternatives to try. Once again, it depends. If you're doing game programming, you likely won't use any OS other than Windows. Otherwise, programming for OS X is just... great! Better than programming for Windows. It's POSIX compliant, it's got llvm/clang (well, errrm, the Apple version of it, which is expected since Apple pioneered llvm). Windows wants llvm/clang, but isn't quite there yet. I'm a C programmer, I used to use Windows every day and it's got the worst C API. I now use Linux, I've used OS X's terminal and I'd rather have OS X than Windows. In fact, I'd rather have OS X than Linux. It reminds me of FreeBSD, which is my favourite. I do kinda miss my games, though... Nonetheless, learn the languages first, then each platform for the languages will be easy to grasp just by reading manuals. Learn everything that seems to have long-term prospects! Seriously, it's your education, and you don't want to short-change yourself, right?
  11. I can see the point of the other posters here. If we assume such a hostile environment that even disabling SSH might not provide a requisite amount of security, then... sorry... you're out of luck! Once someone gains physical access to a system, there are countless ways to circumvent the security. The biggest security consideration I can think of is that someone could duplicate your physical key with almost no effort. Suppose someone inserts a different hard drive, which waits for you to insert the key, makes a copy and sends the copy back to... who knows? Additionally, your key can be modified, and used to gain leverage against you. Suppose a piece of cryptographic ransomware encrypts your key and demands a ransom for its release. Will you be prepared to pay up? I wouldn't want that... but there are no solutions. USB's not entirely a secure protocol, and computers shouldn't be trusting of USB devices by default. Have you considered that the attacker might plug in a USB wireless keyboard transceiver, or disguise a malicious arduino inside of a USB thumb drive which looks exactly the same as yours (and "accidentally drop" it somewhere)?
  12. Greetings, you expressed concerns of using VBScript in spite of lack of experience. Have you tried reading a book? If so, please quote the chapter which confuses you, as I previously prompted. I'm struggling to work out how to help you, aside from doing your work for you... This isn't rentacoder or a freelancer website, and I won't do your work for you for free. If you're looking for a book reco, well, I personally think you've chosen the wrong language. Your system administrators would use bash, curl and crontab for this. It could be hacked together in less than an hour... by someone who knows bash scripting. Perhaps your system administrators could write it for you? Have you asked them? Bottom line: What have you tried?
  13. Commercial web hosting can be had for literally a penny a day. The price for minimum entry dedicated servers is also dirt cheap and competitive. In fact, AWS has the free tier and... someone else has already mentioned Google's option.
  14. While there are some exercises which aren't so structurally bound to the language, I think those which are structurally bound to the language will be the most revealing of the language. Every now and then I look at the Rust book to see if they've added any exercises. I open it up to a random page and just read somewhere. Fascinating stuff, really, but it needs exercises. Good exercises are much less likely to be found or even decent if they have to come from elsewhere, though it can't get much less decent than todays random selection which makes assumptions regarding the machine code which will be emitted...
  15. That looks like Javascript, with some crude graphical library built and included. An hour and it could easily be running in any modern web browser... What's the problem? What have you tried? What are you confused about?
×