Cyclone (programming language): Difference between revisions

Content deleted Content added
Ntninja (talk | contribs)
Be more explicit about the fact that Cyclone is no longer supported and is not directly usable on most modern platforms. Prominently add the developer’s suggested alternative to point people just looking for a “C alternative” in the right direction.
Bender the Bot (talk | contribs)
m top: HTTP to HTTPS for Cornell University
 
(11 intermediate revisions by 7 users not shown)
Line 1:
{{Short description|Memory-safe dialect of the C programming language}}
{{use dmy dates|date=August 2024}}
{{more footnotes|date=August 2015}}
{{Infobox programming language
Line 24 ⟶ 25:
| website = {{URL|http://cyclone.thelanguage.org}}
| wikibooks =
| discontinued = Yes<ref>{{cite web |title=Open Access Cyclone (programming language) Journals · OA.mg |url=https://oa.mg/journals/open-access-cyclone-programming-language-journals |website=oa.mg |access-date=30 October 2022 |archive-date=30 October 2022 |archive-url=https://web.archive.org/web/20221030192542/https://oa.mg/journals/open-access-cyclone-programming-language-journals |url-status=live }}</ref>
}}
The '''Cyclone''' [[programming language]] was intended to be a safe dialect of the [[C (programming language)|C language]].<ref>{{Cite journal |last1=Jim |first1=Trevor |last2=Morrisett |first2=J. Greg |last3=Grossman |first3=Dan |last4=Hicks |first4=Michael W. |last5=Cheney |first5=James |last6=Wang |first6=Yanling |date=2002-06-10 |title=Cyclone: A Safe Dialect of C |url=https://dl.acm.org/doi/10.5555/647057.713871 |journal=Proceedings of the General Track of the Annual Conference on USENIX Annual Technical Conference |series=ATEC '02 |___location=USA |publisher=USENIX Association |pages=275–288 |isbn=978-1-880446-00-3}}</ref> It avoids [[buffer overflow]]s and other vulnerabilities that are possible in C programs by design, without losing the power and convenience of C as a tool for [[system programming]]. It is no longer supported by its original developers, with the reference tooling not supporting [[64-bit computing|64-bit platforms]]. The [[Rust (programming language)|Rust]] language is mentioned by the original developers for having integrated many of the same ideas Cyclone had.<ref>{{cite web |title=Cyclone |url=http://cyclone.thelanguage.org/ |website=cyclone.thelanguage.org |access-date=11 December 2023 |archive-date=21 May 2006 |archive-url=https://web.archive.org/web/20060521202022/http://cyclone.thelanguage.org/ |url-status=live }}</ref>
 
Cyclone development was started as a joint project of Trevor Jim from [[AT&T Labs]] Research and [[Greg Morrisett]]'s group at [[Cornell University]] in 2001. Version 1.0 was released on May 8, 2006.<ref>{{cite web |title=Cyclone |url=httphttps://www.cs.cornell.edu/Projects/cyclone/ |website=[[Cornell University]] |access-date=30 October 2022 |archive-date=15 October 2022 |archive-url=https://web.archive.org/web/20221015034248/https://www.cs.cornell.edu/Projects/cyclone/ |url-status=live }}</ref>
 
==Language features==
Line 83 ⟶ 84:
}
</syntaxhighlight>
This function assumes that the string being passed in is terminated by {{code|NULL}} (<code>'\0'</code>). However, what would happen if {{code|style=white-space:nowrap|2=c|1=char buf[6] = {'h','e','l','l','o','!'};}} were passed to this string? This is perfectly legal in C, yet would cause <code>strlen</code> to iterate through memory not necessarily associated with the string <code>s</code>. There are functions, such as <code>strnlen</code> which can be used to avoid such problems, but these functions are not standard with every implementation of [[ANSI C]]. The Cyclone version of <code>strlen</code> is not so different from the C version:
<syntaxhighlight lang="C">
int strlen(const char ? s)
Line 90 ⟶ 91:
if (s == NULL)
return 0;
for (i = 0; i < n; i++, s++) {
if (*s == '\0')
return i;
}
return n;
}