2

It looks like the load function in q16858 is a copy (except for the correction!) of the load function in q16598. I marked it as a "possible duplicate". I couldn't find any guidance or reporting mechanism here on stack or on reddit or in the courseware. Is there any formal procedure? I am perfectly willing to be wrong. And maybe it's innocent, but it is not coincidence. It quacks.

pset6 load() from 16858

 bool load(FILE* file, BYTE** content, size_t* length)
{
    // TODO
    // allocate memory on the heap
    char* file_content = malloc(sizeof(char)*1000);
    if (file_content == NULL) 
    {
        return false; 
    }

    int i = 0;
    for (int c = fgetc(file); c != EOF; c = fgetc(file))
    {
        if (i % 1000 == 0)
        {
            file_content = realloc(file_content, sizeof(char)*(1000 + i));
        }

        file_content[i] = c;
        i++;
    }
    // add terminating string and increase the size by one
    i++;

    // stores the address of the first byte of file contant in heap
    *content = file_content;
    *length = i;

    return true;
}

pset6 load() from 16598

bool load(FILE* file, BYTE** content, size_t* length)
{
    // allocate memory on the heap
    char* file_content = malloc(sizeof(char)*1000);
    if (file_content == NULL) 
    {
        return false; 
    }

    int i = 0;
    for (int c = fgetc(file); c != EOF; c = fgetc(file))
    {
        if (i % 1000 == 0)
        {
            file_content = realloc(file_content, sizeof(char)*(1000 + i));
        }

        file_content[i] = c;
        i++;
    }
    // add terminating string and increase the size by one
    file_content[i] = '\0';
    i++;

    // stores the address of the first byte of file contant in heap
    *content = file_content;
    *length = i;

    return true;
}

The difference is here (from orginal)

// add terminating string and increase the size by one
file_content[i] = '\0';
i++;

That's where the bug was identified. Further, poster had posted load() earlier in q16845.

1 Answer 1

1

I have run into this a couple of times myself, also to varying degrees. Sometimes it's a matter of code provided in class material being copied (fair use), other times clearly lifting code from someone else's work, warts and all (which is a big clue in itself.)

My opinion is that it should be brought to the attention of staff - read that as moderators - for review by Prof. Malan and his team. Given the impact that punitive action can have, I believe that it should be quietly reported, and more importantly, dealt with by them. That could mean deletion of the code, the question, deletion of the user from this forum, or removal from the class. Keep in mind that actual Harvard students participate here too.

Beyond that, if I am convinced that someone is really stealing work, I will quietly stop responding to any questions that they may post, while keeping a sharp eye out to their questions and their answers (if they're stealing the work of others, how reliable would their response to someone else's question be?) I will also not make public notices of their actions and instead let the powers-that-be deal with it behind the scenes.

To quote Dennis Miller, "But that's just my opinion, I could be wrong." ;-)

1
  • 1
    I have to agree in some way. They are really hurting themselves more then anyone. By not doing the work they are robbing themselves of valuable knowledge that will come back to haunt them. They will just make the mistakes over and over because they do not know how to actually solve problems.
    – Nick Young
    Jul 15, 2016 at 16:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .