sepp2k's Profile User Rating: *****

Reputation: 2132 Grandmaster
Group:
Mentors
Active Posts:
3,277 (2.69 per day)
Joined:
21-June 11
Profile Views:
51,543
Last Active:
User is offline Private
Currently:
Offline

Previous Fields

Country:
DE
OS Preference:
Linux
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
0
Expert In:
C/C++, Functional Programming, Java, Python, Computer Science
Icon   sepp2k has not set their status

Posts I've Made

  1. In Topic: XText error while Workflow compilation

    Posted 23 Oct 2014

    It's not an error, it's a prompt to install a dependency (ANTLR). Type y, then hit enter.
  2. In Topic: destructor concept

    Posted 23 Oct 2014

    View PostDivyanshuj, on 23 October 2014 - 01:58 PM, said:

    It seem to destroy the statically declared objects but cannot destroy dynamically declared objects....


    If you create an object using new, you have to destroy it using delete, otherwise its memory will not be freed (not until the program exits anyway) and its constructor will not be called.

    Quote

    also i need to know...are destructors used only to destroy dynamic objects or static ones...


    A destructor is used to do anything that needs to be done when the object is no longer needed. This includes freeing all memory that has been allocated by the object, closing all file handles, network connections etc. that are only needed by the object, deleting temporary files and so on.

    If none of the members of the object are pointers to dynamically allocated memory and there are no other resources (like temporary files) that need to be disposed of, no destructor is needed.

    Note that it is irrelevant whether the object itself is allocated dynamically or not. The destructor is not responsible for freeing the memory taken up by the object itself - it is only responsible for freeing the memory that it dynamically allocated or any other resources it manually acquired.

    Quote

    i mean why do we need destructor for statically declared objects..the memory allocated to them will be lost as soon as we shut the program down


    All memory is freed when the program exits. The point of freeing dynamically allocated memory is to make sure that you don't leak memory while the program is still running.
  3. In Topic: Creating Language Editor

    Posted 21 Oct 2014

    View PostincredibleX, on 21 October 2014 - 03:17 PM, said:

    Writing plugin for eclipse? or i should start xtext from scratch?


    Xtext is used to write plug-ins for Eclipse. If you want to write a new editor from scratch, you'll have to use something else. I don't think there's a framework for that, so I imagine you'd have to actually do it from scratch. So as I see it, there's four options:

    1. Write a plug-in for Eclipse using Xtext.
    2. Write a plug-in for Eclipse using the standard Eclipse API.
    3. Write a plug-in for some other IDE or editor.
    4. Write your own editor.

    Given that you've never done anything like this before, I'd say option 4 is out of the question.

    Between options 1 and 2, I'd say 1 is probably better as you can get a working plug-in quite quickly (all you need for the basic functionality, which already covers a lot, is a grammar file with some annotations) and depending on your ambitions you might not need any more than that. The main downside of using Xtext would be that you need to write an Xtext grammar and can't reuse your language implementation's parser code. However that may not be an option anyway depending on what language the implementation is written in, how far the implementation is along (like does the parser even exist yet?) and how closely you're going to be cooperating with your partners (i.e. whether you have access to their code).

    3 might be worth considering over 2 as writing a plug-in for a simpler editor can be a lot easier than writing a plug-in for Eclipse. However one of the reasons for that is that those editors often have fewer features, so if you really want to offer all features that one would expect from Eclipse, this may not be an option.
  4. In Topic: Creating Language Editor

    Posted 21 Oct 2014

    You can create a plug-in for JEdit by writing a Java library that uses JEdit's plug-in API and then putting that library into the plug-in directory. Note however that Eclipse also supports plug-ins, so if you only considered JEdit because it supports plug-ins, you might as well stay with Eclipse (especially if you really want all the features that Eclipse offers as JEdit won't offer all of those).

    Xtext can be used to write a complete language implementation, but that doesn't mean you have to. You can easily set it up, so that the Eclipse plug-in generated by Xtext simply invokes your command line compiler/interpreter when you hit the "run" button.
  5. In Topic: Question about pointer

    Posted 21 Oct 2014

    View Postkenryuakuma, on 21 October 2014 - 02:37 AM, said:

    However, with this statement const char* pstr[] = {"ab", "cd"};, won't dereferecing the pointer of the char array *pstr or *(pstr +1) yield the value of "ab" and "cd", instead of the value of their address "23"?


    pstr is an array of pointers. "ab" and "cd" are char pointers (well they're char arrays, but they decay to pointers in this code), so for all intents and purposes "ab" and "cd" are 13 and 23 respectively.

My Information

Member Title:
D.I.C Lover
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Years Programming:
15
Programming Languages:
Haskell, Ruby, OCaml, SML, F#, Scala, Racket/Scheme, Vala, C#, C++, Java

Contact Information

E-mail:
Private
ICQ:
ICQ  205544826
Jabber:
Jabber  sexykane86@jabber.ccc.de