Would it be possible to integrate something like codepad.org or ideone.com into Daniweb? It would be really nice to see the compiler output of code snippets automatically. Consider the difference between

"Help something is wrong!"

#include <iostream>

int main()
{
 cout << hi;
 return 0;
}

and "Help something is wrong!"

http://codepad.org/xpzFkPA8

Of course we want the content to stay local so we don't want to encourage posting links to these external sites, but it also forces people to 1) ensure their code is supposed to be compilable and 2) ensure their error is explained clearly (at least from the compiler's point of view).

Thoughts?

David

Recommended Answers

All 9 Replies

Given that at least Ideone has an API, that's not an unreasonable suggestion. Though many (if not most) code blocks on Daniweb are not meant to be compilable as-is, so the best fit for such a feature would be in our code snippets rather than discussion threads.

Great. If the infrastructure is setup it, it could be mostly used in the code snippets section, but it could also be allowed in discussion threads when appropriate.

[compilable]

[/compilable]

:)

But then again, in code snippets you are supposed to post correctly working tested code to begin with. Not broken code that needs a web-based compiler to fix.

@WaltP - Think of it more as serving as proof that the code works (well, at least compiles).

@Narue - After more thought, I disagree. I think plenty of the very beginner-style questions could/should be formed into a very short piece of "supposed to compile" code. By encouraging users to form the questions in this way it makes them very easy to solve as well as (in my experience) helps them come to the solution themselves. Posting 1000 lines of a tic tac toe game and asking why it doesn't work is not a good exercise for anyone. Extracting 20 lines that are causing a problem lets them inspect just the problem (in the absence of the "noise" of the rest of their project) closely and hopefully understand what is causing it.

> Extracting 20 lines that are causing a problem lets them inspect just the problem (in the absence of the "noise" of the rest of their project) closely and hopefully understand what is causing it.

Codepad won't work for portions of code. For example, If I use the code cout << "test"; it gives me the error message: Line 1: error: expected constructor, destructor, or type conversion before '<<' token
compilation terminated due to -Wfatal-errors.

Even out code snippet section is JUST THAT -- snippets. Someone might post a fully working class or method for others to reuse. We aren't going to expect the majority of code posted within the forums to include all of the header includes and such.

Sure, they'd have to provide a driver (that was included in my 20 line estimate :) ). The goal is to get questions posted in such a way that we can copy/paste/compile to see the error, then fix it easily. We can cut out all 3 steps of the copy/paste/compile with a codepad like system built in, and spend all of our energy fixing the problem.

My other qualm though is that we'd be relying on this third party (how reliable? how trustworthy? what's their uptime? How fast are their servers? How many requests per minute can they handle?). If using their API, we'd also have to adjust our TOS to indicate that code posted on DaniWeb WILL be shared with a third-party.

Sure, they'd have to provide a driver (that was included in my 20 line estimate :) ).

We can't even get them to post with CODE tags and properly formatted! How are we going to get them to write a driver, too? Most of these people think a driver sits in a Toyota, not a computer. :icon_wink:

commented: lol, indeed +0

Hi there,

Of course, they dont provide you auto code completion feature & other fancy features but that is the price you pay for quick & easy way of checking stand alone functions. Plus, in any non-trivial project you need external libraries, I don't know how you would be able to deal with that. Time ago Walter said that online ways to try code snippets (like the ideone and codepad sites, and the Microsoft site to try Spec#) are no good. I am glad to see you don't agree As you remember the Go site has a similar window even on the home page: golang.org (JavaScript required).

Jackie.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.