I'm trying to write a fully generic Stack in C++. I'm not sure if this is the best way to do this.
Right now I know that the Pop method needs improvement since if T is a value type, returning a nullptr will cause a compiler error. Also, I'm pretty sure that this can be optimized in a few way...
Description
To increase the awareness of my previous brainfuck question, not only is there a bounty on it (Thanks, Mat's Mug) but here's also a brainfuck interpreter.
This is written with Java 8
Class Summary (298 lines in 4 files, making a total of 7409 bytes)
BrainF.java: Represents a Brai...
I needed to find whether any image's width at or higher than a certain directory folder exceeds a limit. Is this code a good way of doing this, or is there a way in which it can be improved? I ran it over at least a couple hundred images and several hundred other files contained in the main dir...
I needed to find whether any image's width at or higher than a certain directory folder exceeds a limit. Is this code a good way of doing this, or is there a way in which it can be improved? I ran it over at least a couple hundred images and several hundred other files contained in the main dir...
-ish because I removed the input functionality from the compiler
I've been recently reading up on compilers and how they work.
Although this doesn't use most of the things I've learned about (the lexical and parser things), I thought it would be fun to try create a brainf*ck compiler, rather th...
Challenge:
Write a program which determines the Mth to last element in a list.
Specifications:
The first argument is a path to a file.
The file contains series of space delimited characters
followed by an integer.
The integer represents an index in the list (1-based), one per l...
@SimonAndréForsberg i forgot that iteration is executed on the last iteration even when condition is about to be false. Kind of ironic since I always lean towards signed ints in reviews where reasonable since for (unsigned i = ...; i < 0; --i) is always a fun bug.
I've very new to C++, I've been working through a tutorial and got as far as std::rand(). I was immediately horrified and rushed out to see if I could implement this as a service. This is my (pretty basic) implementation in the style of .Net's System.Random.
There are a number of things I'm unha...
@Corbin well, at first I didn't expect it to execute the code directly, but then I realized that oh, right, it is a compiler and not an interpreter. But yes, outputting C would be more obvious.
While I don't think we should completely remove comparative-review, I do think it might be a good idea to considerably narrow the scope on what's allowed under this tag.
Comparative reviews should be written in the same language.
While it's not impossible to be sitting on the fence about whic...
@janos I don't think you have any answer on any of my recent questions that I can accept. I think I have one answer on one of your questions somewhere that you can accept though :)
I have a "sort by value" Map working, but occasionally it fails based on the sequence of insertions. I know where it fails, but I don't know what to do about it. If the second line in my test is commented out, it works. If that second line is there, I loose the property that my Map does not have ...
I'm writing a words unjumble program. Here is my code:
sortedWords = {}
with open("/Users/xxxx/Desktop/words.txt", "r") as f:
for word in f:
word = word.strip()
sortFword = ''.join(sorted(word))
sortedWords.setdefault(sortFword,[]).append(word)
while True:
jumble ...
@SimonAndréForsberg A question which asks simply "Which is better?" without defining any sort of criteria by which to guide answerers to judge the better piece of code.
@nhgrif it is not clear in the question. I read that paragraph is the last paragraph under the So, what would make for a good comparative review? header, which talks a lot about a specific Java question that you consider a good such question. The transition from that Java question to that last paragraph is not clear.
> And with any sort of "which is better?" question, isn't this too broad? Isn't this not seeking a review? Without appropriate, specific guidelines, isn't this primarily opinion based (even moreso than an average Code Review question)? Isn't this potentially just seeking an explanation of the snippets?
that last part makes it sounds like you consider the Java question too broad.
@nhgrif Those two messages sums up your opinion about this very well, and makes your opinion much more clear. My suggestion: Remove some fluff from your answer and make it more concise.
Anyone is more than welcome to edit it into shape. I felt a long, overly-convincing answer would be especially important given how long we've basically had an anything-goes attitude toward comparative-review